-
-
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
DEPR/CLN: Remove pd.rolling_*, pd.expanding* and pd.ewm* #18723
DEPR/CLN: Remove pd.rolling_*, pd.expanding* and pd.ewm* #18723
Conversation
30b9125
to
4d497f8
Compare
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.
you are removing a lot of tests that should remain
doc/source/whatsnew/v0.22.0.txt
Outdated
@@ -216,7 +216,9 @@ Removal of prior version deprecations/changes | |||
- The ``pandas.io.wb`` and ``pandas.io.data`` stub modules have been removed (:issue:`13735`) | |||
- ``Categorical.from_array`` has been removed (:issue:`13854`) | |||
- The ``freq`` and ``how`` parameters have been removed from the ``rolling``/``expanding``/``ewm`` methods of DataFrame | |||
and Series (deprecated since v0.18). Instead, resample before calling the methods. (:issue:18601 & :issue:18668) | |||
and Series (deprecated since v0.18). Instead, resample before calling the methods. (:issue:`18601`) | |||
- The top-level functions ``pd.rolling_*``, ``pd.expanding_*`` and ``pd.ewm*`` have been removed (deprecated since v0.18). |
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.
don’t remove any issue numbers
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.
Hmm, this and some other stuff that’s unrelated to the pd.rolling stuff seems to be a rebase issue. I’ll fix it tomorrow.
If you want, you can limit the review to only the latest commit, the other commits are because of the rebase issue.
doc/source/whatsnew/v0.22.0.txt
Outdated
@@ -331,5 +333,5 @@ Categorical | |||
Other | |||
^^^^^ | |||
|
|||
- Improved error message when attempting to use a Python keyword as an identifier in a ``numexpr`` backed query (:issue:`18221`) | |||
- Improved error message when attempting to use a Python keyword as an identifier in a numexpr query (:issue:`18221`) |
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.
don’t change other things
12.952, np.nan, np.nan]) | ||
|
||
with catch_warnings(record=True): | ||
rs = mom.rolling_window(vals, 5, 'boxcar', center=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.
don’t remove tests just because we are catching the warning
you may need to rewrite them to use the new syntax
unless they duplicate current tests
4d497f8
to
e311f50
Compare
Codecov Report
@@ Coverage Diff @@
## master #18723 +/- ##
==========================================
+ Coverage 91.61% 91.67% +0.06%
==========================================
Files 153 151 -2
Lines 51339 51120 -219
==========================================
- Hits 47034 46865 -169
+ Misses 4305 4255 -50
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #18723 +/- ##
==========================================
+ Coverage 91.62% 91.69% +0.07%
==========================================
Files 150 148 -2
Lines 48728 48542 -186
==========================================
- Hits 44645 44513 -132
+ Misses 4083 4029 -54
Continue to review full report at Codecov.
|
e311f50
to
06f3ac8
Compare
The rebase issue has been solved now. I'll look at your comments now,. If you've got additional comments, I'd be thakful, and I'll look at them |
71f7036
to
2f8c92f
Compare
Hello @topper-123! Thanks for updating the PR. Cheers ! There are no PEP8 issues in this Pull Request. 🍻 Comment last updated on February 01, 2018 at 06:53 Hours UTC |
2f8c92f
to
07d36f1
Compare
Hi @jreback. An issue is that dask apparently still uses This PR doesn't touch too many files, so it would be ok to wait a bit, but given the simplification to the pandas API that this PR offers, it should IMO be included when 0.22 releases. I've updated the PR, so be'd grateful for a review, so it'll be ready for an eventual pull. |
07d36f1
to
3ed6f56
Compare
The dask versions are deprecated, just like pandas. I believe the best solution would be to
Depending on the timing of pandas 0.22, dask may not have a release out. |
@TomAugspurger , the I've never used dask, and have a feeling I'd have to learn some intricancies of that lib to make such a PR, and I could easily go down a rabbit's hole that I never intended to enter... Could someone familiar with dask not take it upon themselves to do those changes? I can sit on this PR until dask is updated, and rebase when this is ready to merge. |
@topper-123 dask was importing them at the top level if |
@TomAugspurger , thanks for picking up on this, I will wait with my PR a while, until dask is updated. My PR lowers the number of top-level functions of pandas by some 30, so it would IMO be very beneficial to pandas' users to have this merged by 0.22, as it would make pandas look much more focused. Could dask have a release before pandas 0.22, eventually just a minor release? |
* Remove rolling * Remove deprecated rolling methods xref pandas-dev/pandas#18723 * PEP8 * Added reference
3ed6f56
to
dbda864
Compare
dbda864
to
13ed942
Compare
dask 0.16.1 has now been released, and all tests now pass locally with dask version 0.16.1. The travis failure has to do with IO/S3 which I didn't touch. That's the only failure in travis. So, I think everything is ok with my PR. Is there anything I can do to make this pass that travis error, or is this travis failure unrelated to my PR? |
13ed942
to
3e60bbd
Compare
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.
Question about one of the tests
pandas/tests/test_window.py
Outdated
assert result2.dtype == np.float_ | ||
|
||
def _check_ew_structures(self, func, name): | ||
def _check_ew(self, name=None): |
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.
Previously this function consisted of _check_ew_ndarray
and _check_ew_structures
subfunctions to test both interfaces. You removed _check_ew_ndarray
and only kept the content of _check_ew_structures
as this is testing the new interface.
But, as far as I can see, the actual testing was done in _check_ew_ndarray
(_check_ew_structures
is only testing the output class type). Shouldn't this testing be kept? (changed to the new interface)
(might good be I am missing something, or that it is covered in other tests)
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.
I think you are right: So rather than test this function call, test the ewm
method call on a series. I'll look into it tomorrow.
78d4e5d
to
72aa1ce
Compare
@jorisvandenbossche , I've now replicated the code from |
@topper-123 that specific one looks good now I think. |
I've added |
d30c033
to
1eca246
Compare
The tests have been running for 9 hours now and the Travis-CI tests have not yet finished. Same thing happened yesterday where after 20 hours one travis test-suite failed without console output (my guess is it timed out). Is anything wrong with the travis suite? Everything passes locally and the errors that travis reported two days ago have been fixed (but the fixes not confirmed by travis, because I can't get travis to go through them...). What should I do? Could a core dev run the travis tests locally and confirm they're ok, and merge them? |
TravisCI had an outage yesterday, so all the builds were canceled and rescheduled. Looks like yours is 4th on deck at the moment: https://travis-ci.org/pandas-dev/pandas/pull_requests |
Ok, thanks. I'll wait a bit more then. |
All green now🤓 |
when @jorisvandenbossche approves can merge. |
@jorisvandenbossche, I'd really appreciate if you could do this. |
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.
sorry @topper-123, one more question
(it's a very complex file / diff (not your fault!) to review)
result = get_result(arr, 50, min_periods=30) | ||
tm.assert_almost_equal(result[-1], static_comp(arr[10:-10])) | ||
|
||
# min_periods is working correctly |
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.
Do we need to move parts of _check_ndarray
like this part on checking min_periods
to _check_moments_func
?
From a superficial look, it seems that _check_ndarray
did more than _check_structures
(eg in _check_structures
I don't see any assertion of NaNs when min_periods
is specified like here)
I also don't know if test_stable
and test_window
make sense for the new interface
Changes suggested by @jorisvandenbossche implemented and all green. |
pandas/tests/test_window.py
Outdated
r = obj.rolling(window=window, min_periods=min_periods, | ||
center=center) | ||
return getattr(r, name)(**kwargs) | ||
self._check_series(name, static_comp=static_comp, |
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.
I am not sure of the point of adding _check_series
, it seems that you are already checking the series & frame results (line 1344), yes?
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.
if there IS a difference, IOW you are checking something different, then certainly don't make a new function, just in-line it here.
c81e322
to
37abd25
Compare
37abd25
to
75a0c24
Compare
Hi @jreback. I uploaded a new PR 12 days ago. There were a few issues that were checked in
All of the above are inlined in I've rebased a moments ago, without making code changes otherwise, so everything should turn up green & rebased when the tests are finished. |
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.
looks fine. just that 1 question.
@@ -863,72 +848,55 @@ def test_centered_axis_validation(self): | |||
.rolling(window=3, center=True, axis=2).mean()) | |||
|
|||
def test_rolling_sum(self): | |||
self._check_moment_func(mom.rolling_sum, np.nansum, name='sum', |
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.
hmm, shouldn't this be nansum?
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.
Yes. fixed.
75a0c24
to
1443818
Compare
all green. |
@topper-123 Thanks a lot for this! |
…18723) * remove pd.running_*, pd.expanding_* and pd.ewm* and related code * added test_expanding_func and test_expanding_apply * recreate _check_ndarray inline in _check_moment_func
git diff upstream/master -u -- "*.py" | flake8 --diff
This PR removes
pd.rolling_*
,pd.expanding_*
pd.ewm*
and the relatedpd.stats
subpackage from the code base.I have some doubts about some stuff:
doc.plots.stats.*
that I'm not sure of if they should be changed or removed. Currently they're not touched.asv_bench.benchmarks.gil.py
there are calls topd.rolling_*
etc. I've changed this to be method-based.pandas.tests.test_windows.py
I felt was a bit complex to clean up.I would appreciate inputs.