-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
DEPR: Deprecate Series.view #56054
DEPR: Deprecate Series.view #56054
Conversation
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.
Thanks for looking into this one!
pandas/core/series.py
Outdated
@@ -938,6 +938,11 @@ def view(self, dtype: Dtype | None = None) -> Series: | |||
4 2 | |||
dtype: int8 | |||
""" | |||
warnings.warn( | |||
"Series.view is deprecated and will be removed in a future version.", |
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.
Point to astype instead if the goal was to change the dtype?
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
pandas/tests/test_algos.py
Outdated
@@ -47,6 +47,10 @@ | |||
) | |||
import pandas.core.common as com | |||
|
|||
pytestmark = pytest.mark.filterwarnings( | |||
"ignore:Series.view is deprecated and will be removed in a future version.:FutureWarning" # noqa: E501 |
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.
This seems a bit a "dangerous" ignore, because we want to be sure the algos itself aren't raising the warning, and algos seems a part of the codebase that is using view()
regularly (although already not with Series objects apparently, assuming it is correct no change is needed 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.
I can ignore them specifically, will update later
Co-authored-by: Joris Van den Bossche <[email protected]>
Co-authored-by: Joris Van den Bossche <[email protected]>
pandas/core/series.py
Outdated
warnings.warn( | ||
"Series.view is deprecated and will be removed in a future version.", | ||
FutureWarning, | ||
stacklevel=find_stack_level(), |
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.
stacklevel=find_stack_level(), | |
stacklevel=2, |
(see my comment on the ravel PR at #56053 (comment))
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
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 also add a .. deprecated:: 2.2.0
note to the docstring?
# Conflicts: # doc/source/whatsnew/v2.2.0.rst
# Conflicts: # doc/source/whatsnew/v2.2.0.rst
Updated |
Co-authored-by: Joris Van den Bossche <[email protected]>
Any idea why the annoying validate docstring thing is going crazy as soon as I touch the Series.view example? cc @MarcoGorelli maybe? |
I'll take a look tomorrow, but there is a check to verify that it has an example |
Yeah that makes sense but I see tons of unrelated errors, that's what's confusing me, not super urgent, thx |
pandas/core/series.py
Outdated
@@ -881,6 +881,10 @@ def view(self, dtype: Dtype | None = None) -> Series: | |||
type. The new data type must preserve the same size in bytes as to not | |||
cause index misalignment. | |||
|
|||
.. deprecated:: 2.2.0 |
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.
Apparently this block needs to be placed between the short and extended summary, so after the first sentence above.
Maybe somehow the first error is tripping up further checks ...
# Conflicts: # pandas/tests/io/test_sql.py
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.
Thanks!
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.