Skip to content
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

Panel.ffill ignores axis parameter and fill along axis=1 #14499

Closed
Tux1 opened this issue Oct 26, 2016 · 7 comments
Closed

Panel.ffill ignores axis parameter and fill along axis=1 #14499

Tux1 opened this issue Oct 26, 2016 · 7 comments
Labels
Bug Duplicate Report Duplicate issue or pull request Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate

Comments

@Tux1
Copy link
Contributor

Tux1 commented Oct 26, 2016

A small, complete example of the issue

a = pd.Panel({'a':np.arange(15).reshape((5,3)), 'b':np.arange(15,30).reshape((5,3))})
a['a'].loc[1,1] = np.nan

a['a']
Out[36]:
    0     1   2
0   0   1.0   2
1   3   NaN   5
2   6   7.0   8
3   9  10.0  11
4  12  13.0  14

a.ffill(axis=2)['a']
Out[38]:
      0     1     2
0   0.0   1.0   2.0
1   3.0   1.0   5.0
2   6.0   7.0   8.0
3   9.0  10.0  11.0
4  12.0  13.0  14.0

Expected Output

a.at['a', 1, 1] == 3
If you ffill along axis=2, you should get 3 instead of 1

Output of pd.show_versions()

Pandas 0.19.0

@jorisvandenbossche
Copy link
Member

@Tux1 Thanks for the report.

PRs with a fix are certainly welcome (should be rather easy, I think axis has to be passed here: https://github.com/pandas-dev/pandas/blob/v0.19.0/pandas/core/generic.py#L3238). But note that we are not giving Panels many attention anymore for new features: #13563

@Tux1
Copy link
Contributor Author

Tux1 commented Oct 26, 2016

@jorisvandenbossche Yes, it is quite easy to fix. Will do it as soon as i have free time
Yes I know, I am disappointed by this decision

Tux1 added a commit to Tux1/pandas that referenced this issue Oct 28, 2016
Tux1 added a commit to Tux1/pandas that referenced this issue Oct 28, 2016
Tux1 added a commit to Tux1/pandas that referenced this issue Oct 29, 2016
Tux1 added a commit to Tux1/pandas that referenced this issue Oct 29, 2016
@Tux1
Copy link
Contributor Author

Tux1 commented Oct 29, 2016

@jorisvandenbossche finally, it is not as easy as we thought.
I don't see how to handle the case axis=0 because I don't want to loop over major_axis or minor_axis. Any suggestion ?

@jorisvandenbossche
Copy link
Member

@Tux1 In the PR, you now took the approach of raising a NotImplementedError for those cases? I think that is OK to start with

@Tux1
Copy link
Contributor Author

Tux1 commented Oct 29, 2016

@jorisvandenbossche yes but I will break compatibility with pct_change when axis=0 and probably some other function which use fillna
I could bypass forward filling in pct_change when axis=0 but it is a bit dirty

Tux1 added a commit to Tux1/pandas that referenced this issue Nov 2, 2016
Tux1 added a commit to Tux1/pandas that referenced this issue Nov 2, 2016
@Tux1
Copy link
Contributor Author

Tux1 commented Nov 2, 2016

@jorisvandenbossche Finally, it is fine. I handle the case axis=0, it is a bit ugly (I swap axes twice in case axis=0 to fall back on a trivial case) but it works fine.

@jreback jreback added this to the Next Major Release milestone Nov 2, 2016
@jreback jreback added the Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate label Nov 2, 2016
Tux1 added a commit to Tux1/pandas that referenced this issue Nov 12, 2016
Tux1 added a commit to Tux1/pandas that referenced this issue Dec 22, 2016
@jreback jreback added the Duplicate Report Duplicate issue or pull request label Jan 20, 2017
@jreback
Copy link
Contributor

jreback commented Jan 20, 2017

dupe of #8251

@jreback jreback closed this as completed Jan 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Duplicate Report Duplicate issue or pull request Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants