-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Time-based .rolling() fails with .groupby() #13966
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
Comments
Agree that this should work! |
Is there a good workaround? |
related issue: #25 Note: there is a bug using groupby with rolling on specific column for now, so we are not using the `on` parameter in rolling. pandas-dev/pandas#13966
Is the any way to do time aware rolling with group by for now before the new pandas release? |
@ShashankBharadwaj this is not fixed, so new release or not is not going to matter. |
I stumbled on this yesterday as I was trying to solve the same problem. I found a workaround, it's definitely not efficient, but it works.
Hope this helps anyone in the meantime before a bug fix is provided. I haven't contributed to pandas yet, but having used it so much, maybe it's about time :) |
@zscholl Thanks for your workaround. A bug fixes would be great if you're offering. |
I'll take a look at it in the coming weeks, @chrisaycock and see what I can do! |
so this actually works on master now. fixed by #15694 (this will make sure that when sorting a multi-index it actually IS sorting it, previously it would not guarantee monotonic levels, only lexsortedness). so this just needs tests
|
closes pandas-dev#13966 xref to pandas-dev#15130, closed by pandas-dev#15175
closes pandas-dev#13966 xref to pandas-dev#15130, closed by pandas-dev#15175
closes pandas-dev#13966 xref to pandas-dev#15130, closed by pandas-dev#15175
pandas 0.21.0 Traceback (most recent call last): |
The same problem with @sronen71. Has it fixed? |
Additionally, when using Dask;
Returns the |
how about the progress? |
Probably want to hope a new issue with a minimal example if there are
problems.
…On Thu, Mar 14, 2019 at 5:36 AM lycanthropes ***@***.***> wrote:
how about the progress?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#13966 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABQHIvyTz3o5rB64DCox66u4MRJ9J5qcks5vWiYdgaJpZM4JiWlY>
.
|
this issue is fixed |
What I am looking for is to do monthly rolling. Now pandas still does not work with this issue. Such as: |
I can't use window='90D' instead, because sometimes it means a look-ahead bias in strategy backtesting. |
This issue is not perfectly solved, as it does gives the same error of chrisaycock when a Multi-index is formed of the groupby object and the datetime one
|
@GeorgievF pls file a new issue with a reproducible example and using latest pandas |
Done! |
Starting with this example:
I can easily compute the rolling mean by identifier:
Now I want to add a timestamp column:
The timestamps are ordered within each identifier, but pandas complains:
Re-sorting leads to a different error:
But we know that these column names are valid:
It seems like a bug that time-based
.rolling()
does not work with.groupby()
.The text was updated successfully, but these errors were encountered: