Skip to content

BUG: Fix Panel instance variable namespace issue GH3440 #4459

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

Merged
merged 1 commit into from
Aug 5, 2013
Merged
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/release.rst
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ pandas 0.13
(:issue:`4405`, :issue:`4437`)
- Fixed a py3 compat issue where bytes were being repr'd as tuples
(:issue:`4455`)
- Fixed Panel attribute naming conflict if item is named 'a'
(:issue:`3440`)

pandas 0.12
===========
Expand Down
4 changes: 2 additions & 2 deletions pandas/core/panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,12 @@ class Panel(NDFrame):
"""

_AXIS_ORDERS = ['items', 'major_axis', 'minor_axis']
_AXIS_NUMBERS = dict([(a, i) for i, a in enumerate(_AXIS_ORDERS)])
_AXIS_NUMBERS = dict((a, i) for i, a in enumerate(_AXIS_ORDERS))
_AXIS_ALIASES = {
'major': 'major_axis',
'minor': 'minor_axis'
}
_AXIS_NAMES = dict([(i, a) for i, a in enumerate(_AXIS_ORDERS)])
_AXIS_NAMES = dict(enumerate(_AXIS_ORDERS))
_AXIS_SLICEMAP = {
'major_axis': 'index',
'minor_axis': 'columns'
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 @@ -1340,6 +1340,12 @@ def test_rename(self):
def test_get_attr(self):
assert_frame_equal(self.panel['ItemA'], self.panel.ItemA)

# specific cases from #3440
self.panel['a'] = self.panel['ItemA']
assert_frame_equal(self.panel['a'], self.panel.a)
self.panel['i'] = self.panel['ItemA']
assert_frame_equal(self.panel['i'], self.panel.i)

def test_group_agg(self):
values = np.ones((10, 2)) * np.arange(10).reshape((10, 1))
bounds = np.arange(5) * 2
Expand Down