-
-
Notifications
You must be signed in to change notification settings - Fork 18k
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
BUG: resample fixes #12449
BUG: resample fixes #12449
Conversation
@jorisvandenbossche this should take care of 1) and 3) in #12448 and doc 2) |
370d88b
to
8e070c3
Compare
def plot(self, *args, **kwargs): | ||
# for compat with prior versions, we want to | ||
# have the warnings shown here and just have this work | ||
return _maybe_process_deprecations(self, how='mean').plot(*args, |
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.
Small remark, by passing how='mean'
here, the user gets the message "FutureWarning: how in .resample() is deprecated", while he did not use 'how' (in eg s.resample('15min').plot()
)
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, he DID use mean
implicity. Oh you want a more meaningful warning? ok sure
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.
Yep, that is what I mean (a more meaningful warning). As this is now rather confusing to the user IMO, as the warning says something about how
while the user has not explicitely used it (with other operations, you get a "resample is now a deferred operation, please use df.resample().mean() instead
message, which is more appropriate here)
It is possible that the previous workaround with warning ("resample is now a deferred ..") for accessing elements does not work anymore?
I thought this last one worked (gave the same result), but warned? |
For case 3, I still not get the same as in 0.17.1. With this PR:
So the actual grouper has disappeared |
You get the same
I will fix the |
see #12486 I can't fix this now. I think its possible, but will require some work. This is NOT the same as a multi-groupby of a column / freq, because resampling does some auto-filling. To be honest this is prob a bit to magical in the past. |
199c3b4
to
b131f8f
Compare
@jorisvandenbossche any comments? |
The error with the Series is still there (this is not necessarily related to the changes in this PR though):
I think this should give something like iloc does?:
|
BTW, the "assignment will have no effect as you are working on a copy" in that error message is not really clear to me. It's not that it has no effect, as it raises an error. |
On the PR itself, plot change and whatsnew update looks good! |
Something else with getitem:
But these getitem things are not really related to this PR, so I can open another issue for that, and then this PR can be merged |
Are you sure you did with this PR? (for the getitem issue). This is explicity fixed/mentioned.
|
took out the assignment part of the message |
ok, both those errors fixed (and now they show the deprecation warning as well). ping if ok and i'll merge (I need to squash) |
Looks good! |
ok! |
make sure .resample(...).plot() warns and returns a correct plotting object make sure that .groupby(...).resample(....) is hitting warnings when appropriate closes pandas-dev#12448
Hi, I have a FutureWarning from pandas 0.18.0 related to a import pandas as pd
import datetime as dt
df=pd.DataFrame(data=[1,3], index=[dt.timedelta(), dt.timedelta(minutes=3)])
df.resample('1T').interpolate(method='linear') The result I get from the last line is correct but I also get the following warning:
What is wrong with my syntax? |
@benoit9126 No, I think this warning is correct, and I think what you want is:
But that aside, it does maybe make sense to have |
@benoit9126 as @jorisvandenbossche points out, in < 0.18.0 there was an implicit @jorisvandenbossche yes, having a |
@jreback Something else I just noticed, seems like a bug in
Missing the the last value in asfreq? |
@jorisvandenbossche hmm, that last does look like a bug, can you create an issue and i'll take a look. ty. |
Thanks a lot for the explanation. |
@benoit9126 To be clear, there is no guarantee that #12925 will be implemented by 0.19, so it is possible that this code will start raising an error. Your responsibility :-) (or always welcome to put up a PR! I don't think it will be that hard to implement) |
@jorisvandenbossche To be honest I do not have enough time to implement this feature in a close future (especially because I have never carefully inspected the pandas core). If it changes, it will be a pleasure. |
make sure .resample(...).plot() warns and returns a correct plotting object
make sure that .groupby(...).resample(....) is hitting warnings when appropriate
closes #12448