Skip to content

Changed pct_change parameters to calculate pct_change right-to-left f… #39740

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

Closed
wants to merge 1 commit into from

Conversation

andrei-assa
Copy link

@andrei-assa andrei-assa commented Feb 11, 2021

…or axis=1.

@pep8speaks
Copy link

Hello @andrei-assa! Thanks for opening this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 10209:89: E501 line too long (91 > 88 characters)
Line 10211:89: E501 line too long (90 > 88 characters)

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

tests pls

@MarcoGorelli
Copy link
Member

closes #39672

The issue just involves slightly changing the example in the docs, the source code shouldn't need changing

@bashtage
Copy link
Contributor

The issue just involves slightly changing the example in the docs, the source code shouldn't need changing

Fully agree. It is not reasonable to change the behavior of pct_change when applied across columns. It should be the case that pct_change(periods=n) should be the change from df.iloc[:-n] to df.iloc[n:] for positive n and df.iloc[n:] to df.iloc[:-n] for negative n. Adding an axis shouldn't change this behavior, and when computed across columns pct_change(periods=n) should be the change from df.iloc[:,:-n] to df.iloc[:,n:] for positive n and df.iloc[:,n:] to df.iloc[:,:-n] for negative n

@MarcoGorelli
Copy link
Member

closed in #40266 , thanks anyway @andrei-assa for your PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pandas dataframe pct_change function arguments
5 participants