Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
BUG: axis kw not propogating on pct_change #11150
Conversation
|
Thanks. Can you add a test for this? |
sinhrks
added the
Numeric
label
Sep 19, 2015
jreback
changed the title from
Update generic.py to BUG: axis kw not propogating on pct_change
Sep 20, 2015
|
@Tux1 pls add a test for this |
Tux1
closed this
Oct 5, 2015
Tux1
reopened this
Oct 5, 2015
|
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. |
jreback
referenced
this pull request
Oct 5, 2015
Closed
test regarding fix about non propagating along axis on pct_change #11241
|
Sorry... Moreover the test was wrong. |
jreback
commented on an outdated diff
Oct 9, 2015
|
pls add a whatsnew note for 0.17.1 (bug fix), use this PR number |
jreback
added this to the
0.17.1
milestone
Oct 9, 2015
jreback
added the
Bug
label
Oct 9, 2015
jreback
commented on an outdated diff
Oct 9, 2015
| @@ -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) | ||
| + pnl.iat[1,0] = np.nan | ||
| + pnl.iat[1,1] = np.nan | ||
| + | ||
| + expected = pnl.ffill(axis=1).pct_change(axis=1, fill_method=None) |
jreback
Contributor
|
|
@Tux1 can you rebase / update |
Tux1
added some commits
Oct 26, 2015
|
Sorry for several commits. I think that is okay now ? whatsnew edited, commit rebased |
jreback
commented on an outdated diff
Oct 27, 2015
| @@ -96,7 +96,7 @@ Bug Fixes | ||
| - | ||
| +- Bug in ``DataFrame.pct_change()`` was not propagating axis on fillna method (:issue:`11150`) |
jreback
Contributor
|
jreback
commented on an outdated diff
Oct 27, 2015
jreback
and 1 other
commented on an outdated diff
Oct 27, 2015
| @@ -1859,6 +1859,26 @@ def test_pipe_panel(self): | ||
| with tm.assertRaises(ValueError): | ||
| result = wp.pipe((f, 'y'), x=1, y=1) | ||
| + 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 | ||
| + pnl.iat[2,3] = 60 | ||
| + | ||
| + mask = pnl.isnull() | ||
| + | ||
| + expected_axis0 = pnl.ffill(axis=0)/pnl.ffill(axis=0).shift(axis=0) - 1 | ||
| + expected_axis0[mask] = np.nan | ||
| + result_axis0 = pnl.pct_change(axis=0, fill_method='pad') | ||
| + | ||
| + self.assert_frame_equal(result_axis0, expected_axis0) | ||
| + |
jreback
Contributor
|
jreback
commented on an outdated diff
Oct 27, 2015
| @@ -1859,6 +1859,26 @@ def test_pipe_panel(self): | ||
| with tm.assertRaises(ValueError): | ||
| result = wp.pipe((f, 'y'), x=1, y=1) | ||
| + 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 | ||
| + pnl.iat[2,3] = 60 | ||
| + | ||
| + mask = pnl.isnull() | ||
| + | ||
| + expected_axis0 = pnl.ffill(axis=0)/pnl.ffill(axis=0).shift(axis=0) - 1 |
|
|
|
some comments, pls squash when finished |
Tux1
and others
added some commits
Oct 26, 2015
|
pls rebase on master / squash, see docs here |
jreback
commented on an outdated diff
Oct 28, 2015
| @@ -1859,6 +1859,23 @@ def test_pipe_panel(self): | ||
| with tm.assertRaises(ValueError): | ||
| result = wp.pipe((f, 'y'), x=1, y=1) | ||
| + # GH 11150 | ||
| + 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 |
jreback
Contributor
|
|
Sorry, my repo is a mess... I will be better next time |
jreback
added a commit
that referenced
this pull request
Nov 13, 2015
|
|
Tux1 + jreback |
334b076
|
|
merged via 334b076 thanks! |
Tux1 commentedSep 19, 2015
axis option was not correctly set on fillna in pct_change