Skip to content

Conversation

@invain01
Copy link
Contributor

@invain01 invain01 commented Nov 6, 2025

This PR applies the ruff B905 rule to the files in \core.

Modified Files

  1. pandas/core/reshape/concat.py
  2. pandas/core/reshape/encoding.py
  3. pandas/core/reshape/melt.py
  4. pandas/core/reshape/pivot.py

@invain01
Copy link
Contributor Author

invain01 commented Nov 6, 2025

The file pandas/core/reshape/concat.py is not modified,I mistakenly edited.

@invain01
Copy link
Contributor Author

invain01 commented Nov 6, 2025

While adding strict = True in \core\reshape\encoding.py encountering error report,I set strict = False to pass the check.


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
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

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

Copy link
Contributor Author

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?

Copy link
Member

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


if isinstance(prefix, str):
prefix = itertools.cycle([prefix])
prefix = [prefix] * len(data_to_encode.columns)
Copy link
Member

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?

Copy link
Contributor Author

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

@invain01 invain01 requested a review from mroeschke November 6, 2025 16:45
@mroeschke mroeschke added the Code Style Code style, linting, code_checks label Nov 6, 2025
@mroeschke mroeschke added this to the 3.0 milestone Nov 6, 2025
@mroeschke mroeschke merged commit ee172ba into pandas-dev:main Nov 6, 2025
47 checks passed
@mroeschke
Copy link
Member

Thanks @invain01

@invain01 invain01 deleted the new branch November 10, 2025 01:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Code Style Code style, linting, code_checks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants