You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 10, 2024. It is now read-only.
The most common use case for panels I've seen has been as an aligning container for data frames -- you can insert a DataFrame "item" as you would a column normally. This can alleviate some awkwardness when working with multi-indexed data.
Couple questions around panels:
If we drop Panel as an analytical data structure (i.e. what is currently offered by the NDFrame construct), we should consider the API that will replace the current to_panel and to_frame workflows
It may be worthwhile to consider keeping around Panel as a simple container data structure for maintaining a related collection of DataFrames and supporting rudimentary reshaping / axis-swapping functionality. For example, if you have a dict of DataFrame objects in some orientation, you could create a panel, swap axes, then convert to some other data structure (e.g. xarray, MultiIndex-ed DataFrame). If you want to do deeper analysis, you should convert to xarray.
In either case, we'd be eliminating a bunch of thinly supported code
The text was updated successfully, but these errors were encountered:
I agree, keeping around Panel as a simple data container could make sense. I have also found it to be useful as an intermediate data structure for easier data alignment, though I can't think of particular use cases off the top of my head.
xarray is pretty good for aligning! So I predominately use that:
In [5]: df=pd.DataFrame(np.random.rand(3,4), columns=list('abcd'))
In [6]: dfOut[6]:
abcd00.1640630.0148350.5296930.26856110.0760660.5988400.8878230.56611420.5994380.0216460.7751740.959695In [7]: xr.Dataset({'first': df, 'second': df[list('ab')]})
Out[7]:
<xarray.Dataset>Dimensions: (dim_0: 3, dim_1: 4)
Coordinates:
*dim_0 (dim_0) int64012*dim_1 (dim_1) object'a''b''c''d'Datavariables:
second (dim_0, dim_1) float640.16410.01483nannan0.076070.5988 ...
first (dim_0, dim_1) float640.16410.014830.52970.26860.07607 ...
And pandas' stack / unstacking is pretty good for swapping axes.
What's the use case where you'd need functionality in pandas?
we should consider the API that will replace the current to_panel and to_frame workflows
@jreback has built some good .to_xarray, and we've built some decent (not perfect yet) coercion by passing xarray & pandas objects into each others' constructors
The most common use case for panels I've seen has been as an aligning container for data frames -- you can insert a DataFrame "item" as you would a column normally. This can alleviate some awkwardness when working with multi-indexed data.
Couple questions around panels:
If we drop Panel as an analytical data structure (i.e. what is currently offered by the NDFrame construct), we should consider the API that will replace the current
to_panel
andto_frame
workflowsIt may be worthwhile to consider keeping around Panel as a simple container data structure for maintaining a related collection of DataFrames and supporting rudimentary reshaping / axis-swapping functionality. For example, if you have a dict of DataFrame objects in some orientation, you could create a panel, swap axes, then convert to some other data structure (e.g. xarray, MultiIndex-ed DataFrame). If you want to do deeper analysis, you should convert to xarray.
In either case, we'd be eliminating a bunch of thinly supported code
The text was updated successfully, but these errors were encountered: