-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
STY: Add strict=True in zip() in \core #63005
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
|
The file pandas/core/reshape/concat.py is not modified,I mistakenly edited. |
|
While adding strict = True in \core\reshape\encoding.py encountering error report,I set strict = False to pass the check. |
pandas/core/reshape/encoding.py
Outdated
|
|
||
| for col, pre, sep in zip(data_to_encode.items(), prefix, prefix_sep): | ||
| for col, pre, sep in zip( | ||
| data_to_encode.items(), prefix, prefix_sep, strict=False |
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.
what cases need this? does this indicate a bug?
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 just followed the instruction of #62434 (comment) setting strict = True,the CI tests failed.And after checking the output,it means there should be strict = False.
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.
OK, but the point of adding strict=True is to track down potential bugs
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 get it,so may i just revert the change I made in the encoding.py?Or should I find some ways to prove it to make setting strict=True can also pass the CI tests?
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.
either way. the latter would be more helpful but harder
pandas/core/reshape/encoding.py
Outdated
|
|
||
| if isinstance(prefix, str): | ||
| prefix = itertools.cycle([prefix]) | ||
| prefix = [prefix] * len(data_to_encode.columns) |
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 you use itertools.repeat?
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.
Ok,i will edit it right now.Thanks for your guidance
|
Thanks @invain01 |
This PR applies the ruff B905 rule to the files in \core.
Modified Files