-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Series.values deprecation of converts and drops #58856
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
Series.values deprecation of converts and drops #58856
Conversation
I was thinking about changing the stack_level on the warning so we don't need to do as much asserts on the tests. |
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 the PR! In many of the tests, users would be getting a warning about .values
even when they are not using .values
. We need to:
- Determine when the behavior will change on the user, and only raise warnings when it will.
- For cases that will change, raise an appropriate error message. It should make sense to the user why they are getting the warning, and how they can work around it to either preserve the old behavior or adopt future behavior (and silence the warning).
@@ -200,6 +200,7 @@ starting with 3.0, so it can be safely removed from your code. | |||
Other Deprecations | |||
^^^^^^^^^^^^^^^^^^ | |||
|
|||
- Deprecated :meth:`series.values`, now don't drops the ``tz`` from ``dt64tz``, converts ``interval`` to ``object``, converts ``period`` to ``object``. |
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.
Should be Series
(not series
) throughout this PR.
warnings.warn( | ||
"series.values will stop converting tz from dt64tz, interval to object and period to object", | ||
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.
Can you make this warning specific to period / interval. In other words, if they have period data, they should just see the message for period.
warnings.warn( | ||
"series.values will stop converting tz from dt64tz, interval to object and period to object", | ||
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.
If the data is tz-agnostic, then there will be no behavior change. So users should not see a warning.
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.
How can I see if the data is tz-agnostic?
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 believe isinstance(values.dtype, pd.DatetimeTZDtype)
res = self.eval( | ||
"df.dates1 < 20130101", | ||
local_dict={"df": df}, | ||
engine=engine, | ||
parser=parser, | ||
) |
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.
The "user" is not using .values
here, they should not see a warning (at least in regards to using .values
). Will the behavior here actually change for a user?
Thanks for the pull request, but it appears to have gone stale. If interested in continuing, please merge in the main branch, address any review comments and/or failing tests, and we can reopen. |
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.Added the warnings in the function external_values in "pandas/core/internals/blocks.py" and added most of the asserts in the tests. Some tests will not pass, because they sometimes would show the warning and sometimes wouldn't so I didn't know what to do.