BUG: bug in recognizing out-of-bounds on iloc indexers on tuple indexers (GH ) by jreback · Pull Request #7189 · pandas-dev/pandas (original) (raw)

In [1]: p = Panel(np.random.rand(4,3,2), items=['A','B','C','D'], major_axis=['U','V','W'], minor_axis=['X','Y'])

In [2]: p
Out[2]: 
<class 'pandas.core.panel.Panel'>
Dimensions: 4 (items) x 3 (major_axis) x 2 (minor_axis)
Items axis: A to D
Major_axis axis: U to W
Minor_axis axis: X to Y

In [3]: p['A']
Out[3]: 
          X         Y
U  0.541463  0.546778
V  0.079211  0.229914
W  0.621594  0.973252

In [4]: p.iloc[0,:,:]
Out[4]: 
          X         Y
U  0.541463  0.546778
V  0.079211  0.229914
W  0.621594  0.973252

In [5]: p.iloc[0,[True,True,True],:]
Out[5]: 
          X         Y
U  0.541463  0.546778
V  0.079211  0.229914
W  0.621594  0.973252

In [6]: p.iloc[0,[True,True,True],[0,1]]
Out[6]: 
          X         Y
U  0.541463  0.546778
V  0.079211  0.229914
W  0.621594  0.973252

In [7]: p.iloc[0,[True,True,True],[0,1,2]]
IndexError: positional indexers are out-of-bounds

In [8]: p.iloc[0,[True,True,True],[2]]
IndexError: positional indexers are out-of-bounds