Skip to content

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

Merged
merged 10 commits into from
Apr 16, 2024
Merged

Conversation

mroeschke
Copy link
Member

No description provided.

@mroeschke mroeschke added this to the 3.0 milestone Apr 15, 2024
Copy link
Member

@WillAyd WillAyd left a 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

@mroeschke
Copy link
Member Author

One comment but not a blocker

@WillAyd Could you re-post your comment? I don't see it in this PR yet

@@ -3705,7 +3705,7 @@ def transpose(
nv.validate_transpose(args, {})
# construct the args

dtypes = list(self.dtypes)
first_dtype = next(iter(self.dtypes), None)
Copy link
Member

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

Copy link
Member Author

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

@mroeschke mroeschke merged commit 8131381 into pandas-dev:main Apr 16, 2024
46 checks passed
@mroeschke mroeschke deleted the ref/iterators branch April 16, 2024 18:28
pmhatre1 pushed a commit to pmhatre1/pandas-pmhatre1 that referenced this pull request May 7, 2024
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants