Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions doc/source/whatsnew/v0.18.1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,5 @@ Bug Fixes
~~~~~~~~~

- Bug in ``value_counts`` when ``normalize=True`` and ``dropna=True`` where nulls still contributed to the normalized count (:issue:`12558`)

- Bug in ``Panel.fillna`` was ignoring the ``inplace=True`` option. (:issue:`12624`)
3 changes: 2 additions & 1 deletion pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -3122,7 +3122,8 @@ def fillna(self, value=None, method=None, axis=None, inplace=False,
elif self.ndim == 3:

# fill in 2d chunks
result = dict([(col, s.fillna(method=method, value=value))
result = dict([(col, s.fillna(method=method, value=value,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't work as if inplace=True returns None.

inplace=inplace))
for col, s in self.iteritems()])
return self._constructor.from_dict(result).__finalize__(self)

Expand Down
6 changes: 6 additions & 0 deletions pandas/tests/test_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -1528,6 +1528,12 @@ def test_fillna(self):
p.iloc[0:2, 0:2, 0:2] = np.nan
self.assertRaises(NotImplementedError, lambda: p.fillna(999, limit=1))

def test_fillna_inplace(self):
panel = self.panel.copy()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are not actually testing whether this worked or not because there aren't any NA's in the panel!.

panel.fillna(method='backfill', inplace=True)
assert_frame_equal(panel['ItemA'],
self.panel['ItemA'].fillna(method='backfill'))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

further we compare panels with assert_panel_equal


def test_ffill_bfill(self):
assert_panel_equal(self.panel.ffill(),
self.panel.fillna(method='ffill'))
Expand Down