Can't locate items in minor axis

Viewed 28

I am trying to do some pd.Panel manipulation with the following panel:

print(panell)
print(panell.shape)

gives:

<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)

Then I want to loop over the minor_axis but it fails to locate the correct labels. Example, both:

print(panell.loc[:,:,'(38, 3)'])
print(panell[:,:,'(38, 3)'])

gives:

KeyError: 'the label [(38, 3)] is not in the [minor_axis]'

Any suggestions?

1 Answers

You need select by tuple in list:

print(panell.loc[:,:,[(38, 3)]])

because:

print (type(panell.minor_axis[0]))
<class 'tuple'>
Related