-
- Notifications
You must be signed in to change notification settings - Fork 19.3k
API, DEPR: Raise and Deprecate Reshape for Pandas Objects #13012
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
API, DEPR: Raise and Deprecate Reshape for Pandas Objects #13012
Conversation
pandas/core/categorical.py Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you make this a more propert doc-string (e.g. Parameters)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
| need these types of checks for Index as well. might as well combine the checks for Categorical,Index,Series (e.g. make a method to do it in core/base) |
| This is definitely a good idea 👍 |
| had a glance. don't think you are handling |
| @jreback : Actually, on second thought:
|
208eaa8 to 2c7160e Compare |
|
|
| see my point above |
| Ah, okay, I see. Let them all raise then. Should be relatively straightforward. |
| @gfyoung but |
| Shouldn't we do the same with |
| yes, didn't realize that |
| Alrighty, so I'll deprecate for both |
2c7160e to 5498dc9 Compare Current coverage is 84.38%@@ master #13012 diff @@ ========================================== Files 142 142 Lines 51225 51235 +10 Methods 0 0 Messages 0 0 Branches 0 0 ========================================== + Hits 43225 43234 +9 - Misses 8000 8001 +1 Partials 0 0
|
| @jreback : I've added deprecation and raising behaviour for |
| let's do this in 0.19.0 |
e77529e to e902d79 Compare pandas/core/categorical.py Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it needed to add this documentation on new_shape if we are deprecating its usage?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, would make these really simple.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this is really a numpy thing, I'm just going to point the documentation on new_shape to np.reshape (we're deprecating this function after all, so I don't feel too bad for tying it to numpy).
| @jreback What is the reason of adding a For people using |
| @jorisvandenbossche we dont technically need this on |
24b6067 to 3860bc2 Compare | @jreback , @jorisvandenbossche : Made requested doc changes (no need to run Travis on those, hence the |
| @gfyoung See my comment from above: #13012 (comment) |
| @jorisvandenbossche: Ah whoops, good point. Will do. |
3860bc2 to 118d75f Compare pandas/core/internals.py Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is this for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh I see.
ok, need an internal function to do this then (rather than having this duplicated code)
put in pandas.types.concat maybe compat_reshape
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
It was throwing warnings during testing.
-
The current code for
Series.reshapewill simply callself._values.reshape(...), so I am preempting that so we don't have to call thereshapemethod forSeries.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and that's fine, except for have code duplication, so just put it in an internal function as I said above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't get that second note until after I posted mine. 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Though why pandas.types.concat? We aren't really concatenating anything here. My first inclination was to try to put in pandas.compat, but I don't see a good home for it there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
u can also put in internals
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. Done.
118d75f to e849f9c Compare pandas/indexes/base.py Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you put "Not implemented" on the first line? As otherwise in the methods overview in the Index docstring, you will see the reshape method with this explanation, and from that it would seem it has a working reshape method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do as soon as Travis gives a green light.
| lgtm (minor doc comments). will need a rebase after #13147 |
9c4e7a9 to 229060b Compare 229060b to 3ad161d Compare | @jreback : Made the requested doc changes as well as rebased, and Travis is still passing. Ready to merge if there are no other concerns. |
| thanks @gfyoung |
Remove the method for Series, Categorical, and Index. Deprecated or errored in v0.19.0 xref pandas-devgh-13012
Remove the method for Series, Categorical, and Index. Deprecated or errored in v0.19.0 xref gh-13012
Remove the method for Series, Categorical, and Index. Deprecated or errored in v0.19.0 xref pandas-devgh-13012
reshapelargely exists for compat reasons withnumpybut in the interests of moving away from that, this PR will cause objects likeSeries,Index, andCategoricalto deprecate OR raise when such a method is called.