Skip to content

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

Closed
@seth-p

Description

@seth-p

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolate

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions