我有一个DF,其中的时间戳被转换为datetime(),我想创建一个Python表来按月和按年聚合,但是我得到了以下错误:
ValueError: Duplicated level name: "TimeStamp", assigned to level 1, is already used for level 0
flowData =pd.read_csv('...')
flowData["TimeStamp"] = pd.to_datetime(flowData["TimeStamp"])
pv = flowData.pivot_table(index=flowData['TimeStamp'].dt.month,columns=flowData['TimeStamp'].dt.year, values='Value', aggfunc=np.mean)
pv.head()
尝试重命名索引:
相关问题 更多 >
编程相关推荐