我正在尝试对从 excel 导入的数据运行排序,但出现以下错误。为什么在导入数据框后说它的有序字典?
-错误:
'OrderedDict' object has no attribute 'sort'
代码:
import pandas as pd
dfs = pd.read_excel("data.xlsx", sheet_name=None)
dfs
data_df = (dfs.sort(['Date','Tank','Time']).groupby(['Date','Tank']))
data_df
DF:
OrderedDict([(u'Sheet1',
Date Time Tank Sales Quantity Delivery
0 2018-01-01 06:30:00 1 100 3444 0
1 2018-01-01 07:00:00 1 200 3144 0
2 2018-01-01 05:30:00 1 100 2900 0
3 2018-01-01 07:30:00 1 200 2800 0
4 2018-01-01 06:30:00 2 50 3000 0
5 2018-01-01 07:00:00 2 100 2950 0
6 2018-01-01 05:30:00 2 150 2800 0
7 2018-01-01 07:30:00 2 100 2704 0
8 2018-01-02 06:30:00 1 100 3444 0
9 2018-01-02 07:00:00 1 200 3144 0
10 2018-01-02 05:30:00 1 100 2900 50
11 2018-01-02 07:30:00 1 200 2800 0
12 2018-01-02 06:30:00 2 50 3000 0
13 2018-01-02 07:00:00 2 100 2950 0
14 2018-01-02 05:30:00 2 150 2800 50
15 2018-01-02 07:30:00 2 100 2704 0)])
相关分类