Skip to content

BUG: Make sure correct values are passed to Rolling._on when axis=1 #28267

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

Merged
merged 6 commits into from
Sep 4, 2019

Conversation

MarcoGorelli
Copy link
Member

@MarcoGorelli MarcoGorelli commented Sep 3, 2019

if self.axis == 0:
return self.obj.index
elif self.axis == 1:
return self.obj.transpose().index
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can just call self.obj.columns instead of having to transpose.

@mroeschke mroeschke added Bug Datetime Datetime data dtype Window rolling, ewma, expanding labels Sep 3, 2019
@MarcoGorelli MarcoGorelli changed the title Make sure correct values are passed to Rolling._on when axis=1 BUG: Make sure correct values are passed to Rolling._on when axis=1 Sep 3, 2019
@jreback jreback added this to the 1.0 milestone Sep 4, 2019
@jreback
Copy link
Contributor

jreback commented Sep 4, 2019

lgtm. @mroeschke think we need more testing for this?

@@ -334,3 +334,26 @@ def test_readonly_array(self):
result = pd.Series(arr).rolling(2).mean()
expected = pd.Series([np.nan, 2, np.nan, np.nan, 4])
tm.assert_series_equal(result, expected)

def test_rolling_datetime(self, axis_frame):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One last thing: Could you parameterize over the tz_naive_fixture?

@pep8speaks
Copy link

pep8speaks commented Sep 4, 2019

Hello @MarcoGorelli! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2019-09-04 16:32:05 UTC

@mroeschke mroeschke merged commit 0bde7ce into pandas-dev:master Sep 4, 2019
@mroeschke
Copy link
Member

Thanks @MarcoGorelli!

@MarcoGorelli MarcoGorelli deleted the the-rolling-datetimes branch September 4, 2019 17:10
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
…andas-dev#28267)

* Make sure correct values are passed to Rolling._on when axis=1

* Update rolling.py

* Capitalise 'd' as in documentation

* Parametrize over tz_naive_fixture

* autoformat
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
…andas-dev#28267)

* Make sure correct values are passed to Rolling._on when axis=1

* Update rolling.py

* Capitalise 'd' as in documentation

* Parametrize over tz_naive_fixture

* autoformat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Datetime Datetime data dtype Window rolling, ewma, expanding
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rolling with offset and axis=1
4 participants