-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
REF: Clean up some iterator usages #58267
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
Conversation
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.
Generally lgtm. One comment but not a blocker. Nice work
@WillAyd Could you re-post your comment? I don't see it in this PR yet |
pandas/core/frame.py
Outdated
@@ -3705,7 +3705,7 @@ def transpose( | |||
nv.validate_transpose(args, {}) | |||
# construct the args | |||
|
|||
dtypes = list(self.dtypes) | |||
first_dtype = next(iter(self.dtypes), None) |
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.
Can't this just be self.dtypes[0] if self.dtypes else None
? Going through the iteration protocol seems overkill
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.
Yup sure thing. Will change to this
* Use better data structures * Use generator and set * Move sorted to exception block, use set instead of list * Another iterator, use iter * another set * Dont use iterator protocol
No description provided.