-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH: implement __iter__ for window objects #11704
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
I don't know if this is too ambitious, but for custom rolling aggregation, if you can let users supply a |
Currently, iterating over a Until the |
@selik if you want to submit a PR to raise NotImplementedError would be great! |
Until Issue pandas-dev#11704 is completed, raise a NotImplementedError to provide a more clear error message when attempting to iterate over a Rolling or Expanding window.
* ENH: Raise useful error when iterating a Window Until Issue #11704 is completed, raise a NotImplementedError to provide a more clear error message when attempting to iterate over a Rolling or Expanding window.
* ENH: Raise useful error when iterating a Window Until Issue pandas-dev#11704 is completed, raise a NotImplementedError to provide a more clear error message when attempting to iterate over a Rolling or Expanding window.
* ENH: Raise useful error when iterating a Window Until Issue pandas-dev#11704 is completed, raise a NotImplementedError to provide a more clear error message when attempting to iterate over a Rolling or Expanding window.
Okay, how to cope with this problem then ? I have an object, |
@antoinecomp Could you share a bit more of your code and the error message? The traceback will help. Also, what kind of object is EWM? |
@selik Sorry for answering so late. This is the code I used:
And this is the error message:
|
It looks like pandas/pandas/core/dtypes/inference.py Line 495 in caf462c
Reverting to the old behavior won't fix this, because @topper-123 @evectant I'm not familiar with the @jreback Should |
I'm getting the same error in core\windows.py Any solution or idea how to fix or troubleshoot? |
@TexFly Are you trying to iterate over a window object? If so, it's as the error says: not implemented. |
It's easy to run into this error if you (forgivably, IMO) assume that series.ewm(...) will return another Series, and you try to iterate over it. In fact it's returning a pandas.core.window.EWM object, and you have to call .mean() on it to get the actual exponentially weighted moving average. |
@antoinecomp Did you solve the error. I am getting the same. |
There's a stalled branch at #27399 if anyone wants to pick this up. |
I have a Dataframe i was planning to use with ewm, but it seems that when I say:
it will tell me it is a NotImplementedError and points to come to this Github error. Is there a new way we should be doing this, in either 0.25.0 or 1.0.1? |
@antoinecomp |
…as-dev#15354) and a hint to how to handle iterating windows (pandas-dev#11704)
In which pandas version it will appear? The |
1.1 (See the "milestone" on this issue). |
xref #11603
might be slightly non-trivial as the current impl does NOT use an explict iterator, rather does a sliding window in cython and marginal calcs.
The text was updated successfully, but these errors were encountered: