Skip to content

Commit 41704e2

Browse files
author
Martin Journois
committed
ENH: _dir_additions returns also the first level of a MultiIndex
1 parent e001500 commit 41704e2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pandas/core/generic.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,11 @@ def __unicode__(self):
195195
def _dir_additions(self):
196196
""" add the string-like attributes from the info_axis """
197197
additions = set([c for c in self._info_axis
198-
if isinstance(c, string_types) and isidentifier(c)])
198+
if isinstance(c, string_types) and isidentifier(c)] +
199+
[c[0] for c in self._info_axis
200+
if isinstance(c, tuple) and
201+
isinstance(c[0], string_types) and
202+
isidentifier(c[0])])
199203
return super(NDFrame, self)._dir_additions().union(additions)
200204

201205
@property

0 commit comments

Comments
 (0)