-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
BUG: Fix series rename called with str altering name rather index (GH17407) #17654
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
3e3e925
99300dd
b9ee088
4996e76
41436c2
f97c9bc
45d30d4
a1f9565
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
or
to and
for checking iterable
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -263,9 +263,10 @@ def is_list_like(obj): | |
False | ||
""" | ||
|
||
return ((hasattr(obj, '__iter__') or isinstance(obj, Iterable)) and | ||
return (hasattr(obj, '__iter__') and isinstance(obj, Iterable) and | ||
not isinstance(obj, string_and_binary_types)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do this with an or between iter and collections....
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. using or doesn't work, as |
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. pls run a sub-set of the perf tests (IOW something like this)
and report any significant diffs. This touches code from almost everywhere indirectly so want to make sure no regressions. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. See comments below for what the performance tests reported. |
||
|
||
def is_nested_list_like(obj): | ||
""" | ||
Check if the object is list-like, and that all of its elements | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be an
or
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see your point, but that wont fix the issue. What about only check
isinstance(obj, Iterable)
? I'm asking this because I see another function ininference.py
called_iterable_not_string
, it checks againstcollections.Iterable
rather check for__iter__
attribute.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can try but this is used pretty much everywhere and you will break things. Technically a
type
satisfies this condition I think, but we DO want to exlude it. you could also add it to thenot isinstance(obj, (string_types, type))
. might work.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've checked,
type
actually doesn't satisfy the condition. Also all the tests have passed after the change.