-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
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
Deprecate Series.strides, .base, .data, .itemsize, .flags (numpy) attributes ? #20419
Comments
In xarray we have real/imag but all these other low level NumPy attributes are dropped ( |
What are people's feeling about |
I'm fine with keeping |
I am hitting the deprecation warning on using the |
It also looks like this planned deprecation is not mentioned in the docs, and definitely should be if it's raising |
this was deprecated several versions ago |
May I ask why you need
That's a good point! PR to add this to the docstrings very welcome. |
Yeah, it was not the most straight forward way to do boxcox. It was still confusing. |
But seems there are no documents about what are the replacements of those attributes? Since pandas 1.0.0, how to get strides of a pandas Series? |
There is no explicit replacement. A pandas Series is not guaranteed to have strides. You can convert the Series to a numpy array ( |
Related to #18262, but since this is a very specific class of attributes, thought to open a specific issue about it.
We have a bunch of attributes on the
Series
class that stem from the time it was a numpy array subclass, and now just pass through the attribute of the underlying numpy array. It are typically attributes describing the data layout specific to the numpy array, which I don't think necessarily makes sense for a Series:Series.base
Series.data
Series.strides
Series.itemsize
Series.flags
and potentially also:
Series.real
andSeries.imag
So deprecating those can potentially remove 7 entries from the Series namespace.
Are there good reasons to keep them? Is this somehow useful for "compatibility" (writing code that works for both series as numpy array)
(I personally can't think of a usecase where you would want one of the above, unless you explicitly know will deal with numpy arrays)
One of the problems might be that if we refer users to
Series.values.<attribute>
that this will depend on the underlying array type if that will work or not (eg if.values
starts giving an ExtensionArray, it will also not have those attributes)cc @shoyer I don't think you kept those for "compatibility" in DataArray in xarray?
And in dask I think
itemsize
,real
andimag
is provided.The text was updated successfully, but these errors were encountered: