-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
Refactored Resample API breaking change #11841
Changes from all commits
e570570
83238ed
68428d6
c54ea69
750556b
e243f18
b4dfbc5
b2056ca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,16 +70,59 @@ nfrequencies are unaffected. The prior defaults were causing a great deal of | |
confusion for users, especially resampling data to daily frequency (which | ||
labeled the aggregated group with the end of the interval: the next day). | ||
|
||
Note: | ||
|
||
.. ipython:: python | ||
|
||
dates = pd.date_range('1/1/2000', '1/5/2000', freq='4h') | ||
series = Series(np.arange(len(dates)), index=dates) | ||
series | ||
series.resample('D', how='sum') | ||
# old behavior | ||
series.resample('D', how='sum', closed='right', label='right') | ||
.. code-block:: python | ||
|
||
In [1]: dates = pd.date_range('1/1/2000', '1/5/2000', freq='4h') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You don't have to change it here (as you do it in other places as well) , but just a general comment as this is something that has been bothering me for a time :-) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sure, np. I think I just copy pasted from somewhere else :) |
||
|
||
In [2]: series = Series(np.arange(len(dates)), index=dates) | ||
|
||
In [3]: series | ||
Out[3]: | ||
2000-01-01 00:00:00 0 | ||
2000-01-01 04:00:00 1 | ||
2000-01-01 08:00:00 2 | ||
2000-01-01 12:00:00 3 | ||
2000-01-01 16:00:00 4 | ||
2000-01-01 20:00:00 5 | ||
2000-01-02 00:00:00 6 | ||
2000-01-02 04:00:00 7 | ||
2000-01-02 08:00:00 8 | ||
2000-01-02 12:00:00 9 | ||
2000-01-02 16:00:00 10 | ||
2000-01-02 20:00:00 11 | ||
2000-01-03 00:00:00 12 | ||
2000-01-03 04:00:00 13 | ||
2000-01-03 08:00:00 14 | ||
2000-01-03 12:00:00 15 | ||
2000-01-03 16:00:00 16 | ||
2000-01-03 20:00:00 17 | ||
2000-01-04 00:00:00 18 | ||
2000-01-04 04:00:00 19 | ||
2000-01-04 08:00:00 20 | ||
2000-01-04 12:00:00 21 | ||
2000-01-04 16:00:00 22 | ||
2000-01-04 20:00:00 23 | ||
2000-01-05 00:00:00 24 | ||
Freq: 4H, dtype: int64 | ||
|
||
In [4]: series.resample('D', how='sum') | ||
Out[4]: | ||
2000-01-01 15 | ||
2000-01-02 51 | ||
2000-01-03 87 | ||
2000-01-04 123 | ||
2000-01-05 24 | ||
Freq: D, dtype: int64 | ||
|
||
In [5]: # old behavior | ||
In [6]: series.resample('D', how='sum', closed='right', label='right') | ||
Out[6]: | ||
2000-01-01 0 | ||
2000-01-02 21 | ||
2000-01-03 57 | ||
2000-01-04 93 | ||
2000-01-05 129 | ||
Freq: D, dtype: int64 | ||
|
||
- Infinity and negative infinity are no longer treated as NA by ``isnull`` and | ||
``notnull``. That they ever were was a relic of early pandas. This behavior | ||
|
@@ -354,4 +397,3 @@ Adding experimental support for Panel4D and factory functions to create n-dimens | |
See the :ref:`full release notes | ||
<release>` or issue tracker | ||
on GitHub for a complete list. | ||
|
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.
maybe also add
count
andnunique
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.
count
there, addednunique