-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: axis kw not propogating on pct_change #11150
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
Conversation
axis option was not correctly set on fillna
Thanks. Can you add a test for this? |
@Tux1 pls add a test for this |
Sorry. It is my first commit. |
pls see the contributing docs: http://pandas.pydata.org/pandas-docs/stable/contributing.html tests / fix should be on a single pr. |
Sorry... Moreover the test was wrong. |
@@ -1851,6 +1851,15 @@ def test_pipe_panel(self): | |||
with tm.assertRaises(ValueError): | |||
result = wp.pipe((f, 'y'), x=1, y=1) | |||
|
|||
def test_pct_change(self): | |||
pnl = DataFrame([np.arange(0, 40, 10), np.arange(0, 40, 10), np.arange(0, 40, 10)]).astype(np.float64) |
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.
add the issue number here
pls add a whatsnew note for 0.17.1 (bug fix), use this PR number |
pnl.iat[1,0] = np.nan | ||
pnl.iat[1,1] = np.nan | ||
|
||
expected = pnl.ffill(axis=1).pct_change(axis=1, fill_method=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.
test with axis 0, 2 as well (if their are existing tests for that, pls move them here)
further this should be a bit more generic (or append _frame) to the test name as the generic.py
tests should test Series,DataFrame,Panel
@Tux1 can you rebase / update |
test regarding buf fix on pct_change propagation axis revamping test_pct_change. Rename, multi axis and error fixed
Sorry for several commits. I think that is okay now ? whatsnew edited, commit rebased |
@@ -96,7 +96,7 @@ Bug Fixes | |||
|
|||
|
|||
|
|||
|
|||
- Bug in ``DataFrame.pct_change()`` was not propagating axis on fillna method (:issue:`11150`) |
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.
use double backticks around axis
(and say axis
keyword) and 'on .fillna()
method'
some comments, pls squash when finished |
test_pct_change with loop over axis backtick added
Add an optional argument to _NDFrameIndexer._align_series to indicate if the indexer is from a MultiIndex
pls rebase on master / squash, see docs here |
def test_pct_change_frame(self): | ||
pnl = DataFrame([np.arange(0, 40, 10), np.arange(0, 40, 10), np.arange(0, 40, 10)]).astype(np.float64) | ||
pnl.iat[1,0] = np.nan | ||
pnl.iat[1,1] = np.nan |
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 mean that this function needs to move to tests\test_frame.py
(and not in test_generic.py
)
Sorry, my repo is a mess... I will be better next time |
merged via 334b076 thanks! |
axis option was not correctly set on fillna in pct_change