mindpandas.DataFrame
DataFrame是一个具有行、列索引的二维表数据结构,是MindSpore Pandas主要的数据结构之一。
DataFrame构造
通过字典构建DataFrame示例:
import mindpandas as pd
import numpy as np
d = {'col1': [1, 2], 'col2': [3, 4]}
df = pd.DataFrame(data=d)
print(df)
运行结果如下:
col1 col2
0 1 3
1 2 4
指定数据类型:
df = pd.DataFrame(data=d, dtype=np.int8)
print(df.dtypes)
运行结果如下:
col1 int8
col2 int8
dtype: object
通过numpy ndarray构造DataFrame:
df2 = pd.DataFrame(np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]),
columns=['a', 'b', 'c'])
print(df2)
运行结果如下:
a b c
0 1 2 3
1 4 5 6
2 7 8 9
DataFrame API
MindSpore Pandas DataFrame API |
Pandas API |
支持平台 |
---|---|---|
mindpandas.DataFrame.add |
CPU |
|
mindpandas.DataFrame.all |
CPU |
|
mindpandas.DataFrame.any |
CPU |
|
mindpandas.DataFrame.apply |
CPU |
|
mindpandas.DataFrame.applymap |
CPU |
|
mindpandas.DataFrame.astype |
CPU |
|
mindpandas.DataFrame.columns |
CPU |
|
mindpandas.DataFrame.combine |
CPU |
|
mindpandas.DataFrame.copy |
CPU |
|
mindpandas.DataFrame.count |
CPU |
|
mindpandas.DataFrame.cumsum |
CPU |
|
mindpandas.DataFrame.div |
CPU |
|
mindpandas.DataFrame.drop |
CPU |
|
mindpandas.DataFrame.drop_duplicates |
CPU |
|
mindpandas.DataFrame.dropna |
CPU |
|
mindpandas.DataFrame.dtypes |
CPU |
|
mindpandas.DataFrame.duplicated |
CPU |
|
mindpandas.DataFrame.empty |
CPU |
|
mindpandas.DataFrame.eq |
CPU |
|
mindpandas.DataFrame.fillna |
CPU |
|
mindpandas.DataFrame.ge |
CPU |
|
mindpandas.DataFrame.groupby |
CPU |
|
mindpandas.DataFrame.gt |
CPU |
|
mindpandas.DataFrame.head |
CPU |
|
mindpandas.DataFrame.iloc |
CPU |
|
mindpandas.DataFrame.index |
CPU |
|
mindpandas.DataFrame.insert |
CPU |
|
mindpandas.DataFrame.isin |
CPU |
|
mindpandas.DataFrame.isna |
CPU |
|
mindpandas.DataFrame.iterrows |
CPU |
|
mindpandas.DataFrame.le |
CPU |
|
mindpandas.DataFrame.loc |
CPU |
|
mindpandas.DataFrame.lt |
CPU |
|
mindpandas.DataFrame.max |
CPU |
|
mindpandas.DataFrame.mean |
CPU |
|
mindpandas.DataFrame.median |
CPU |
|
mindpandas.DataFrame.memory_usage |
CPU |
|
mindpandas.DataFrame.merge |
CPU |
|
mindpandas.DataFrame.min |
CPU |
|
mindpandas.DataFrame.mul |
CPU |
|
mindpandas.DataFrame.ne |
CPU |
|
mindpandas.DataFrame.prod |
CPU |
|
mindpandas.DataFrame.product |
CPU |
|
mindpandas.DataFrame.rename |
CPU |
|
mindpandas.DataFrame.replace |
CPU |
|
mindpandas.DataFrame.reset_index |
CPU |
|
mindpandas.DataFrame.shape |
CPU |
|
mindpandas.DataFrame.sort_values |
CPU |
|
mindpandas.DataFrame.squeeze |
CPU |
|
mindpandas.DataFrame.std |
CPU |
|
mindpandas.DataFrame.sub |
CPU |
|
mindpandas.DataFrame.sum |
CPU |
|
mindpandas.DataFrame.tail |
CPU |
|
mindpandas.DataFrame.transpose |
CPU |
|
mindpandas.DataFrame.values |
CPU |
|
mindpandas.DataFrame.var |
CPU |