-
-
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2349,11 +2349,21 @@ def external_values(values: ArrayLike) -> ArrayLike: | |
proper extension array). | ||
""" | ||
if isinstance(values, (PeriodArray, IntervalArray)): | ||
warnings.warn( | ||
"series.values will stop converting tz from dt64tz, interval to object and period to object", | ||
FutureWarning, | ||
stacklevel=find_stack_level(), | ||
) | ||
Comment on lines
+2352
to
+2356
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
return values.astype(object) | ||
elif isinstance(values, (DatetimeArray, TimedeltaArray)): | ||
# NB: for datetime64tz this is different from np.asarray(values), since | ||
# that returns an object-dtype ndarray of Timestamps. | ||
# Avoid raising in .astype in casting from dt64tz to dt64 | ||
warnings.warn( | ||
"series.values will stop converting tz from dt64tz, interval to object and period to object", | ||
FutureWarning, | ||
stacklevel=find_stack_level(), | ||
) | ||
Comment on lines
+2362
to
+2366
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. I believe |
||
values = values._ndarray | ||
|
||
if isinstance(values, np.ndarray): | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1507,12 +1507,16 @@ def test_nested_period_index_subscript_expression(self): | |
def test_date_boolean(self, engine, parser): | ||
df = DataFrame(np.random.default_rng(2).standard_normal((5, 3))) | ||
df["dates1"] = date_range("1/1/2012", periods=5) | ||
res = self.eval( | ||
"df.dates1 < 20130101", | ||
local_dict={"df": df}, | ||
engine=engine, | ||
parser=parser, | ||
) | ||
with tm.assert_produces_warning( | ||
FutureWarning, | ||
match="series.values will stop converting tz from dt64tz, interval to object and period to object", | ||
): | ||
res = self.eval( | ||
"df.dates1 < 20130101", | ||
local_dict={"df": df}, | ||
engine=engine, | ||
parser=parser, | ||
) | ||
Comment on lines
+1514
to
+1519
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The "user" is not using |
||
expec = df.dates1 < "20130101" | ||
tm.assert_series_equal(res, expec) | ||
|
||
|
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
(notseries
) throughout this PR.