-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH: Construct Panel from 2D structured array #14511
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Take a look at xarray: http://xarray.pydata.org/en/stable/pandas.html#transitioning-from-pandas-panel-to-xarray There are plans to eventually deprecate Panel. |
@shoyer Thanks for the link. I looked, but I don't entirely follow. It sounds like you're saying that Pandas Panel will be deprecated but the replacement will be an entirely different library that has to be installed separately. Am I understanding that correctly? |
@jzwinck That is indeed correct. Pandas will not directly replace Panels with something else if they are deprecated, as we believe that I will close this issue, as we will not probably actively work on enhancements to panels. You can always make a helper function for the 'verbose' way yourself. |
Right now (0.18.1), I can construct a DataFrame from a "1D" structured array. The NumPy structure field names are used as the Pandas column names.
But I cannot construct a Panel from a structured array:
One "obvious" way is slow:
And an efficient way is verbose:
Note that both of the above ways "promote" all values to a single dtype, which in my case (float + bool) becomes object. That's really bad--I need to preserve the original dtypes so that if I do
panel[0].dtypes
matchesarr[0].dtype
. I created #14512 for that problem.Background for this issue is here: http://stackoverflow.com/questions/40259034/construct-pandas-panel-from-2d-structured-numpy-array
I'm using Pandas 0.18.1.
The text was updated successfully, but these errors were encountered: