Skip to content

Commit 9cc7215

Browse files
author
Martin Journois
committed
ENH: _dir_additions returns also the first level of a MultiIndex
1 parent 32f562d commit 9cc7215

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pandas/core/generic.py

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

202206
@property

0 commit comments

Comments
 (0)