python - Indexing a pandas.Panel counterintuitive or a bug? -
I am having trouble understanding the indexing of a pandal. Panel (3D Data Structure) It says that works as indexing:
P> Now I will assume that the order of the remaining index is not changed when the dataframe is drawn, but:Obtaining value from a multi-axis object that uses the following notation (for example Using .loc on, but applies to .iloc and Ix too) Any of the axes can have an empty slice: Axis left out of the specification is considered:. (Egploc ['A'] is equivalent to PL ['A',:, ::])
p.loc [item_indexer, major_indexer, minor_indexer]
(2, 3, 4) PILOok [0]. Size # Basic order out [5]: (3, 4) p. LOOM [2]:, 0] .shape # transposed out [6]: (4, 2) p. Loc [:,:, 0] .shape # transposed out [7]: (3, 2) p. Iloc [,, 0, [8]: (4, 2) p. Loc [1:, 0,:]. Size # Slicing item_inxter, then move out [9]: (4, 1) P.I.Looc [1:, 0] Expecting to get .shape # in the same form [9], but instead of slicing minor_enxor Line Out [10]: (3, 2)
Any idea why dataframe is changed while indexing main_index or short_index, but not item_index? And why is it different from the last example?
There has been some discussion recently. It seems that pandals are not very well prepared in the direction of en-dimensional data (N> = 3). An optional module, which is like pandals but otherwise for ND data, you can use plain pandes (2D) dataframe with Multi Index to simulate ND data.
Comments
Post a Comment