Skip to content

Commit d45f6dc

Browse files
errors fixes
1 parent 576c07d commit d45f6dc

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

pandas/core/indexes/base.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -568,9 +568,12 @@ def __new__(
568568
data = com.asarray_tuplesafe(data, dtype=_dtype_obj)
569569

570570
#60925 should raise when one of index's items is a list and others are not
571-
if any(isinstance(el, list) for el in data) and not all(isinstance(el, list) for el in data):
572-
raise ValueError("Index names must all be hashable, or all lists to make MultiIndex")
573-
571+
if (any(isinstance(el, list) for el in data) and
572+
not all(isinstance(el, list) for el in data)):
573+
raise ValueError(
574+
"Index names must all be hashable, or all lists to make MultiIndex"
575+
)
576+
574577
try:
575578
arr = sanitize_array(data, None, dtype=dtype, copy=copy)
576579
except ValueError as err:

pandas/tests/indexes/test_index_new.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def test_constructor_list_between_elems(self):
195195
data = ['a', ['b', 'c'], ['b', 'c']]
196196
with pytest.raises(ValueError, match=msg):
197197
Index(data)
198-
198+
199199
data = [['b', 'c'], ('b', 'c')]
200200
with pytest.raises(ValueError, match=msg):
201201
Index(data)

0 commit comments

Comments
 (0)