Skip to content

Commit a833cc1

Browse files
author
Martin Journois
committed
ENH: _dir_additions returns only the 100 first values of the index' first level
1 parent fdba133 commit a833cc1

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

pandas/core/generic.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,12 @@ def __unicode__(self):
195195
return '%s(%s)' % (self.__class__.__name__, prepr)
196196

197197
def _dir_additions(self):
198-
""" add the string-like attributes from the info_axis """
199-
additions = set([c for c in self._info_axis
200-
if isinstance(c, string_types) and isidentifier(c)])
198+
""" add the string-like attributes from the info_axis.
199+
If info_axis is a MultiIndex, it's first level values are used.
200+
"""
201+
additions = set(
202+
[c for c in self._info_axis.unique(level=0)[:100]
203+
if isinstance(c, string_types) and isidentifier(c)])
201204
return super(NDFrame, self)._dir_additions().union(additions)
202205

203206
@property

0 commit comments

Comments
 (0)