DEPR: Deprecate Series.view by phofl · Pull Request #56054 · pandas-dev/pandas (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation17 Commits16 Checks0 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

@phofl

@phofl

jorisvandenbossche

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!

dtype: int8
"""
warnings.warn(
"Series.view is deprecated and will be removed in a future version.",

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?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah

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

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)

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

@phofl @jorisvandenbossche

Co-authored-by: Joris Van den Bossche jorisvandenbossche@gmail.com

@phofl @jorisvandenbossche

Co-authored-by: Joris Van den Bossche jorisvandenbossche@gmail.com

jorisvandenbossche

warnings.warn(
"Series.view is deprecated and will be removed in a future version.",
FutureWarning,
stacklevel=find_stack_level(),

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))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

jorisvandenbossche

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?

@phofl

@phofl

Conflicts:

doc/source/whatsnew/v2.2.0.rst

@phofl

Conflicts:

doc/source/whatsnew/v2.2.0.rst

@phofl

jorisvandenbossche

@phofl @jorisvandenbossche

Co-authored-by: Joris Van den Bossche jorisvandenbossche@gmail.com

@phofl

Any idea why the annoying validate docstring thing is going crazy as soon as I touch the Series.view example?

cc @MarcoGorelli maybe?

@MarcoGorelli

I'll take a look tomorrow, but there is a check to verify that it has an example

@phofl

Yeah that makes sense but I see tons of unrelated errors, that's what's confusing me, not super urgent, thx

jorisvandenbossche

type. The new data type must preserve the same size in bytes as to not
cause index misalignment.
.. deprecated:: 2.2.0

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 ...

@phofl

@phofl

Conflicts:

pandas/tests/io/test_sql.py

jorisvandenbossche

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Labels