diff --git a/RELEASE.rst b/RELEASE.rst index 3f371d89c1e44..3e751952e9790 100644 --- a/RELEASE.rst +++ b/RELEASE.rst @@ -120,6 +120,8 @@ pandas 0.9.0 - Fix unicode console encoding issue in IPython notebook (#1782, #1768) - Fix unicode formatting issue with Series.name (#1782) - Fix bug in DataFrame.duplicated with datetime64 columns (#1833) + - Fix bug in Panel internals resulting in error when doing fillna after + truncate not changing size of panel (#1823) pandas 0.8.1 ============ diff --git a/pandas/core/internals.py b/pandas/core/internals.py index 39e51628d63fe..e33d98cdab837 100644 --- a/pandas/core/internals.py +++ b/pandas/core/internals.py @@ -949,6 +949,12 @@ def reindex_axis(self, new_axis, method=None, axis=0, copy=True): if copy: result = self.copy(deep=True) result.axes[axis] = new_axis + + if axis == 0: + # patch ref_items + for blk in result.blocks: + blk.ref_items = new_axis + return result else: return self diff --git a/pandas/tests/test_panel.py b/pandas/tests/test_panel.py index 27125771ee0bc..ead6ba842ee36 100644 --- a/pandas/tests/test_panel.py +++ b/pandas/tests/test_panel.py @@ -897,6 +897,13 @@ def test_fillna(self): filled = empty.fillna(0) assert_panel_equal(filled, empty) + def test_truncate_fillna_bug(self): + # #1823 + result = self.panel.truncate(before=None, after=None, axis='items') + + # it works! + result.fillna(value=0.0) + def test_swapaxes(self): result = self.panel.swapaxes('items', 'minor') self.assert_(result.items is self.panel.minor_axis)