Skip to content

Commit 45d30d4

Browse files
committed
Only check against Iterable in is_list_like and add test for str
1 parent f97c9bc commit 45d30d4

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

Diff for: doc/source/whatsnew/v0.21.0.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -588,10 +588,11 @@ Indexing
588588
- Bug in ``CategoricalIndex`` reindexing in which specified indices containing duplicates were not being respected (:issue:`17323`)
589589
- Bug in intersection of ``RangeIndex`` with negative step (:issue:`17296`)
590590
- Bug in ``IntervalIndex`` where performing a scalar lookup fails for included right endpoints of non-overlapping monotonic decreasing indexes (:issue:`16417`, :issue:`17271`)
591+
<<<<<<< f97c9bc2d44f7aa58314fe67f1fa074af3032473
591592
<<<<<<< 4996e764fb0adbd5c77574eb3cb60f19c0fafba3
592593
<<<<<<< 99300ddcc636c859a02b3010ee379d1adbd1678e
593594
- Bug in :meth:`DataFrame.first_valid_index` and :meth:`DataFrame.last_valid_index` when no valid entry (:issue:`17400`)
594-
- Bug in ``Series.rename`` when called with a `callable` alters name of series rather than index of series. (:issue:`17407`)
595+
- Bug in :func:`Series.rename` when called with a `callable`, incorrectly alters the name of the `Series`, rather than the name of the `Index`. (:issue:`17407`)
595596

596597
I/O
597598
^^^

Diff for: pandas/core/dtypes/inference.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ def is_list_like(obj):
263263
False
264264
"""
265265

266-
return (hasattr(obj, '__iter__') and isinstance(obj, Iterable) and
266+
return (isinstance(obj, Iterable) and
267267
not isinstance(obj, string_and_binary_types))
268268

269269

Diff for: pandas/tests/dtypes/test_inference.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def __getitem__(self):
5858
def test_is_list_like():
5959
passes = ([], [1], (1, ), (1, 2), {'a': 1}, set([1, 'a']), Series([1]),
6060
Series([]), Series(['a']).str)
61-
fails = (1, '2', object())
61+
fails = (1, '2', object(), str)
6262

6363
for p in passes:
6464
assert inference.is_list_like(p)

0 commit comments

Comments
 (0)