Skip to content

Commit

Permalink
BUG: fix error after Panel truncate copy close #1823
Browse files Browse the repository at this point in the history
  • Loading branch information
wesm committed Sep 9, 2012
1 parent cfd2005 commit b66dc9c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions RELEASE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
============
Expand Down
6 changes: 6 additions & 0 deletions pandas/core/internals.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions pandas/tests/test_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit b66dc9c

Please sign in to comment.