furniture = furniture.groupby('Order Date')['Sales'].sum().reset_index()
print(furniture.head())
输出:
Order Date Sales
0 2014-01-06 2573.820
1 2014-01-07 76.728
2 2014-01-10 51.940
3 2014-01-11 9.940
4 2014-01-13 879.939
当我想有一个月的平均销售。所以补充
y = furniture['Sales'].resample('MS').mean()
输出:
TypeError: Only valid with DatetimeIndex, TimedeltaIndex or PeriodIndex, but got an instance of 'RangeIndex'
我可以理解我的订单日期列不是时间戳格式。我不知道如何转换它
有什么想法吗
目前没有回答
相关问题 更多 >
编程相关推荐