mindpandas.DataFrame
The DataFrame is a two-dimensional table data structure with row and column indexes, and is one of the main data structures of MindSpore Pandas.
DataFrame Construction
Constructing DataFrame from a dictionary:
import mindpandas as pd
import numpy as np
d = {'col1': [1, 2], 'col2': [3, 4]}
df = pd.DataFrame(data=d)
print(df)
The result is as follows:
col1 col2
0 1 3
1 2 4
To enforce a single dtype:
df = pd.DataFrame(data=d, dtype=np.int8)
print(df.dtypes)
The result is as follows:
col1 int8
col2 int8
dtype: object
Constructing DataFrame from numpy ndarray:
df2 = pd.DataFrame(np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]),
columns=['a', 'b', 'c'])
print(df2)
The result is as follows:
a b c
0 1 2 3
1 4 5 6
2 7 8 9
DataFrame API
MindSpore Pandas DataFrame API |
Pandas API |
Supported Platform |
---|---|---|
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 |