DataFrame 数据准备
参数
参数 | 格式 | 说明 |
---|---|---|
data | ndarray (structured or homogeneous), Iterable, dict, or DataFrame | 字典可以包含序列、数组、常量或类似列表的对象 |
index | Index or array-like | |
columns | Index or array-like | |
dtype | dtype, default None | 强制设置数据类型,只允许一个dtype,如果是None,则自动判断 |
copy | boolean, default False |
属性
属性 | 说明 |
---|---|
T | 列和行互换 |
at | 根据行和列获取/设置 某元素。例:df.at[4,'B'] or df.at.[4,'B'] = 10 |
axes | 返回一个列表,行和列的数据的格式 |
columns | 返回数据 DataFrame 列 |
dtypes | 返回数据 DataFrame 的 dtypes. |
empty | 数据 DataFrame 是否为空,返回 True or False. |
ftypes | Return the ftypes (indication of sparse/dense and dtype) in DataFrame.(数据密度???) |
iat | 根据整数访问行和列的单个值。例:df.iat[1,2] or df.iat[1,2] = 10 |
iloc | Purely integer-location based indexing for selection by position. |
index | 返回数据 DataFrame 行. |
is_copy | Return the copy. |
ix | A primarily label-location based indexer, with integer position fallback. |
loc | 获取列 df.loc[1] or df.loc[[0,1]] |
ndim | Return an int representing the number of axes / array dimensions. |
shape | 返回数据 DataFrame 维数的元组(行和列的数量). |
size | 对象元素数量 |
style | Property returning a Styler object containing methods for building a styled HTML representation fo the DataFrame. |
values | 返回 DataFrame 的 Numpy 格式 |