-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
API: Added squeeze keyword to MultiIndex ctors
Adds a new ``squeeze`` keyword to control whether the various MultiIndex constructors should squeeze down to an ``Index`` when all the values are length-1 tuples. In [3]: MultiIndex.from_tuples([('a',), ('b',), ('c',)]) Out[3]: Index(['a', 'b', 'c'], dtype='object') In [4]: MultiIndex.from_tuples([('a',), ('b',), ('c',)], squeeze=False) Out[4]: MultiIndex(levels=[['a', 'b', 'c']], labels=[[0, 1, 2]]) This is helpful for routines that rely on the MultiIndex constructors always returning a MultiIndex, regardless of the data values (e.g. hash_tuples).
- Loading branch information
1 parent
929c66f
commit 999035e
Showing
3 changed files
with
76 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters