我正在尝试对以下面板进行一些 pd.Panel
操作:
print(panell)
print(panell.shape)
给出:
<class 'pandas.core.panel.Panel'>
Dimensions: 9 (items) x 60 (major_axis) x 114 (minor_axis)
Items axis: 31.5hz to 8000hz
Major_axis axis: 2018-10-22 07:00:00 to 2018-10-24 18:00:00
Minor_axis axis: (1, 1) to (38, 3)
(9, 60, 114)
然后我想遍历 minor_axis
但它无法找到正确的标签。示例,两者:
print(panell.loc[:,:,'(38, 3)'])
print(panell[:,:,'(38, 3)'])
给出:
KeyError: 'the label [(38, 3)] is not in the [minor_axis]'
有什么建议吗?
最佳答案
您需要按列表中的元组进行选择:
print(panell.loc[:,:,[(38, 3)]])
因为:
print (type(panell.minor_axis[0]))
<class 'tuple'>
关于python - 无法在短轴中找到项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52929641/