Skip to content

BUG: Panel.fillna() ignores inplace=True #12624

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
seth-p opened this issue Mar 14, 2016 · 2 comments · Fixed by #21879
Closed

BUG: Panel.fillna() ignores inplace=True #12624

seth-p opened this issue Mar 14, 2016 · 2 comments · Fixed by #21879
Labels
Bug Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
Milestone

Comments

@seth-p
Copy link
Contributor

seth-p commented Mar 14, 2016

I'm not sure of Panel is still being supported, but Panel.fillna() seems to ignore inplace=True:

In [1]: import numpy as np

In [2]: import pandas as pd

In [5]: p1 = pd.Panel([[[0,1],[2,np.nan]], [[10,11],[12,np.nan]]], items=['a','b'], minor_axis=['x','y'])

In [7]: p1['a']
Out[7]:
     x    y
0  0.0  1.0
1  2.0  NaN

In [8]: p1['b']
Out[8]:
      x     y
0  10.0  11.0
1  12.0   NaN

In [9]: p1.fillna(method='ffill', inplace=True)
Out[9]:
<class 'pandas.core.panel.Panel'>
Dimensions: 2 (items) x 2 (major_axis) x 2 (minor_axis)
Items axis: a to b
Major_axis axis: 0 to 1
Minor_axis axis: x to y

In [10]: p1['a']
Out[10]:
     x    y
0  0.0  1.0
1  2.0  NaN

In [11]: p1['b']
Out[11]:
      x     y
0  10.0  11.0
1  12.0   NaN

In [12]: p2 = p1.fillna(method='ffill', inplace=True)

In [13]: p2['a']
Out[13]:
     x    y
0  0.0  1.0
1  2.0  1.0

In [14]: p2['b']
Out[14]:
      x     y
0  10.0  11.0
1  12.0  11.0

In [15]: pd.show_versions()
INSTALLED VERSIONS
------------------
commit: None
python: 3.4.4.final.0
python-bits: 64
OS: Windows
OS-release: 10
machine: AMD64
processor: Intel64 Family 6 Model 62 Stepping 4, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None

pandas: 0.18.0
nose: 1.3.7
pip: 8.1.0
setuptools: 20.2.2
Cython: None
numpy: 1.10.4
scipy: 0.17.0
statsmodels: 0.6.1
xarray: 0.7.1
IPython: 4.1.2
sphinx: None
patsy: 0.4.1
dateutil: 2.5.0
pytz: 2016.1
blosc: None
bottleneck: None
tables: 3.2.2
numexpr: 2.5
matplotlib: 1.5.1
openpyxl: 2.3.3
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: 4.4.1
html5lib: 1.0b8
httplib2: None
apiclient: None
sqlalchemy: 1.0.12
pymysql: None
psycopg2: 2.6.1 (dt dec pq3 ext lo64)
jinja2: 2.8
boto: None
@jreback
Copy link
Contributor

jreback commented Mar 14, 2016

hmm, that should work. ok will mark it. thanks.

@jreback jreback added Bug Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate labels Mar 14, 2016
@jreback jreback added this to the 0.18.1 milestone Mar 14, 2016
Xbar added a commit to Xbar/pandas that referenced this issue Mar 17, 2016
jreback pushed a commit that referenced this issue Mar 17, 2016
Added if condition for fillna when ndim==3 (for Panel) Issue:
#12624

Author: Xbar <wishyx@gmail.com>

Closes #12633 from Xbar/master and squashes the following commits:

cfb3882 [Xbar] BUGFIX: fillNA for panel (ndim==3) Issue: 12624
@jreback
Copy link
Contributor

jreback commented Mar 17, 2016

closed by #12633

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
Projects
None yet
2 participants