-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DEPR: Period[B] #53511
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: Period[B] #53511
Conversation
@@ -217,6 +217,7 @@ def test_line_plot_period_mlt_frame(self, frqncy): | |||
freq = df.index.asfreq(df.index.freq.rule_code).freq | |||
_check_plot_works(df.plot, freq) | |||
|
|||
@pytest.mark.filterwarnings(r"ignore:PeriodDtype\[B\] is deprecated:FutureWarning") |
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.
do we need to find a workaround in plotting before doing this?
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.
yes. suppressing the warning on this test is OK, but i think we need a better solution than suppressing here https://github.com/pandas-dev/pandas/pull/53511/files#diff-9e7653bee8c4fb4e42459af383020b7d754df6c55e79680d20e81d588d51f029R283
+1 on deprecating. What about the other Business offsets? |
The other business offsets aren't used for Period. (Confusion about that is common, which is part of why i want to decouple offsets from Period entirely) |
pandas/_testing/__init__.py
Outdated
return pd.period_range(start=dt, periods=k, freq="B", name=name, **kwargs) | ||
with warnings.catch_warnings(): | ||
warnings.simplefilter("ignore") | ||
pi = pd.period_range(start=dt, periods=k, freq="B", name=name, **kwargs) |
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 possible to use another freq like "D"?
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.
Doing that breaks a handful of tests. I could go either way on changing it now vs after enforcement.
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.
Would slightly prefer changing now to hopefully prevent potentially having to change more tests in the future
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.
Fair enough, updated
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.
generally looks good, just got a couple of questions on some tests
pandas/tests/resample/conftest.py
Outdated
rng = period_range(start, end, freq=freq) | ||
with warnings.catch_warnings(): | ||
# suppress Period[B] deprecation warning | ||
warnings.simplefilter("ignore") |
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.
could we be more precise with the simplefilter
please? I think this may set a bad example for new contributors wanting to silence warnings and looking for existing patterns of how to do it
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.
good point, will update
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.
no objections
Thanks @jbrockmendel |
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.There's a place in the plotting code where we apparently cast to Period, not sure why that would be necessary. Need to find an alternative before the deprecation is enforced.