jeffalstott
jeffalstott

Reputation: 2693

Pandas MultiIndex versus Panel

Using Pandas, what are the reasons to use a Panel versus a MultiIndex DataFrame?

I have personally found significant difference between the two in the ease of accessing different dimensions/levels, but that may just be my being more familiar with the interface for one versus the other. I assume there are more substantive differences, however.

Upvotes: 14

Views: 2770

Answers (2)

Kamaraju Kusumanchi
Kamaraju Kusumanchi

Reputation: 1964

Panel has been deprecated in pandas v0.20.1 (May 5, 2017) and will be removed in a future version. It is recommended to represent 3-D data with a MultiIndex on a DataFrame via the to_frame() or with the xarray package.

References:

Upvotes: 3

gmask
gmask

Reputation: 242

In my practice, the strongest, easiest-to-see difference is that a Panel needs to be homogeneous in every dimension. If you look at a Panel as a stack of Dataframes, you cannot create it by stacking Dataframes of different sizes or with different indexes/columns. You can indeed handle more non-homogeneous type of data with multiindex.

So the first choice has to be made based on how your data is to be organized.

Upvotes: 10

Related Questions