[英]Difference between pandas objects (index, ndarray, etc) and datatypes (e.g. bool, int, float)?
I'm learning pandas and have a pretty basic question.我正在学习熊猫并且有一个非常基本的问题。 I get that pandas introduces a lot of different new objects based on numpy arrays (like index and numpy array), but how are these 'objects' that exist in pandas different from pandas datatypes I'm learning like np.bool, int, float, datetime64?
我知道 Pandas 引入了许多基于 numpy 数组(如索引和 numpy 数组)的不同新对象,但是 Pandas 中存在的这些“对象”与我正在学习的 Pandas 数据类型有何不同,例如 np.bool、int、float ,datetime64?
If objects like pandas index's are lego blocks that allow us to do things in pandas, what are these datatypes considered?如果像熊猫索引这样的对象是允许我们在熊猫中做事的乐高积木,那么这些数据类型是什么? are datatypes also pandas objects?
数据类型也是熊猫对象吗?
Pandas objects DataFrame
, Index
and Series
provide the high level data structure. Pandas 对象
DataFrame
、 Index
和Series
提供高级数据结构。
DataFrame
is a 2-dimensional labeled data structure with columns of potentially different types. DataFrame
是一种二维标记数据结构,具有可能不同类型的列。 You can think of it like a spreadsheet or SQL table, or a dictionary of Series
objects.您可以将其视为电子表格或 SQL 表,或
Series
对象的字典。
Index
encapsulates the row and column labels. Index
封装了行和列标签。
Series
encapsulates a one-dimensional numpy.ndarray
containing the column data, row labels and the column label. Series
封装了一个一维的numpy.ndarray
其中包含列数据、行标签和列标签。
See Pandas DataFrame data structure for details.有关详细信息,请参阅Pandas DataFrame 数据结构。
Each column data is a numpy.ndarray
object of a specific numpy data type like bool ( numpy.bool_
), int ( numpy.int32
, numpy.int64
, etc.), float ( numpy.float32
, numpy.float64
, etc.) and others.每列数据都是特定numpy 数据类型的
numpy.ndarray
对象,如 bool ( numpy.bool_
)、int ( numpy.int32
、 numpy.int64
等)、 float ( numpy.float32
、 numpy.float64
等)和别的。 NumPy supports a much greater variety of numerical types than Python. NumPy 支持的数值类型比 Python 多得多。
See Data types in Python, Numpy and Pandas for details.有关详细信息,请参阅Python、Numpy 和 Pandas 中的数据类型。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.