You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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).
Copy file name to clipboardExpand all lines: doc/source/whatsnew/v0.21.0.txt
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -77,6 +77,8 @@ Other Enhancements
77
77
- :func:`read_feather` has gained the ``nthreads`` parameter for multi-threaded operations (:issue:`16359`)
78
78
- :func:`DataFrame.clip()` and :func:`Series.clip()` have gained an ``inplace`` argument. (:issue:`15388`)
79
79
- :func:`crosstab` has gained a ``margins_name`` parameter to define the name of the row / column that will contain the totals when ``margins=True``. (:issue:`15972`)
80
+
- The various :class:`MultiIndex` constructors all take a ``squeeze`` keyword to control whether to squeeze down to a regular ``Index`` when
81
+
the values are all tuples of length one (the default is ``True``, as before) (:issue:`17178`)
80
82
- :func:`DataFrame.select_dtypes` now accepts scalar values for include/exclude as well as list-like. (:issue:`16855`)
81
83
- :func:`date_range` now accepts 'YS' in addition to 'AS' as an alias for start of year (:issue:`9313`)
82
84
- :func:`date_range` now accepts 'Y' in addition to 'A' as an alias for end of year (:issue:`9313`)
0 commit comments