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

Closed
jorisvandenbossche opened this Issue Mar 20, 2018 · 3 comments

Comments

Projects
None yet
4 participants
@jorisvandenbossche
Member

jorisvandenbossche commented Mar 20, 2018

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 and Series.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 and imag is provided.

@shoyer

This comment has been minimized.

Member

shoyer commented Mar 20, 2018

In xarray we have real/imag but all these other low level NumPy attributes are dropped (.data means something else entirely). I agree with deprecating these for Series.

@jorisvandenbossche

This comment has been minimized.

Member

jorisvandenbossche commented Apr 17, 2018

What are people's feeling about imag and real? They were added back explicitly (#4819) after they disappeared with the Series refactor (for backwards compatibility).

@jreback jreback added this to the 0.23.0 milestone Apr 19, 2018

@TomAugspurger

This comment has been minimized.

Contributor

TomAugspurger commented Apr 23, 2018

I'm fine with keeping real and imag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment