Skip to content

Commit db13c3b

Browse files
committed
Use not is_list_like
1 parent fbd20f5 commit db13c3b

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

doc/source/whatsnew/v0.20.0.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ Bug Fixes
351351
- Bug in converting object elements of array-like objects to unsigned 64-bit integers (:issue:`4471`, :issue:`14982`)
352352
- Bug in ``pd.pivot_table()`` where no error was raised when values argument was not in the columns (:issue:`14938`)
353353

354-
- Bug in ``DataFrame.groupby().describe()`` when grouping on ``Index`` containing tuples (:issue:`14848`)
354+
- Bug in ``DataFrame.groupby().describe()`` when grouping on ``Index`` containing tuples. Raise `ValueError` if creating an `Index` with tuples and not passing a list of names (:issue:`14848`)
355355

356356

357357

pandas/indexes/multi.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
is_object_dtype,
2121
is_iterator,
2222
is_list_like,
23-
is_string_like,
2423
is_scalar)
2524
from pandas.types.missing import isnull, array_equivalent
2625
from pandas.core.common import (_values_from_object,
@@ -493,9 +492,8 @@ def _set_names(self, names, level=None, validate=True):
493492

494493
# GH 15110
495494
# Don't allow a single string for names in a MultiIndex
496-
if names is not None and is_string_like(names):
497-
raise ValueError('Names should not be a single string for a '
498-
'MultiIndex.')
495+
if names is not None and not is_list_like(names):
496+
raise ValueError('Names should be list-like for a MultiIndex')
499497
names = list(names)
500498

501499
if validate and level is not None and len(names) != len(level):

0 commit comments

Comments
 (0)