-
-
Notifications
You must be signed in to change notification settings - Fork 19.1k
DEPR: implicit resample in plotting #62433
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
base: main
Are you sure you want to change the base?
Conversation
data = data.tz_localize(None).to_period(freq=freq_str) | ||
elif isinstance(data.index, ABCPeriodIndex): | ||
data.index = data.index.asfreq(freq=freq_str, how="start") | ||
# This will convert e.g. freq="60min" to freq="min", but will |
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 bit is unrelated, can revert and do it in a separate branch
"will raise in a future version. Align series frequencies " | ||
"before plotting instead.", |
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 go as far to suggest f"Call series.resample('{freq}') ..."
?
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.
Sure.
But now im wondering how much this will even help in moving towards #54485. In order to check if we're in this situation we still need the state information attached somehow.
I know "nuke it from space" isn't a viable approach to the plotting code, but it is really really bad.
|
||
msg = "Plotting with mixed-frequency series is deprecated" | ||
with tm.assert_produces_warning(Pandas4Warning, match=msg): | ||
s.plot(secondary_y=True) |
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.
it isn't clear to me why the warning is emitted here since ax
isn't passed. if that keyword isn't the relevant factor in deciding if the statefulness is needed, then #62442 may not achieve its goals
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.The use cases for this are all along the lines of
In this case,
ser2
gets silently resampled (period-style, which is different from regular resample i think) so that the x-axis matches the plot forser1
. (I think. We don't have any comments/docstrings explaining "why" for any of the plotting code).In these cases, "reindex yourself" is a totally valid workaround. Since this is a big use case for kludged state information, I'm hopeful it will move us in the direction of #54485 too.