Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

STY: Add strict=True in zip() in to_dict.py #62589

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
mroeschke merged 2 commits into pandas-dev:main from invain01:STY-Enforce-Ruff-rule-B905
Oct 5, 2025

Conversation

Copy link
Contributor

@invain01 invain01 commented Oct 5, 2025

Summary

This change enforces Ruff rule B905 (zip-without-explicit-strict) by adding strict=True to all zip() function calls in pandas/core/methods/to_dict.py. This ensures that input iterables are of equal length, preventing silent truncation and potential data inconsistencies.

Modified File

  • pandas/core/methods/to_dict.py

Specific Changes

The following 6 zip() calls were updated to include strict=True:

  1. Line 201: zip(box_na_values, df.items())zip(box_na_values, df.items(), strict=True)
  2. Line 238: zip(columns, map(maybe_box_native, row))zip(columns, map(maybe_box_native, row), strict=True)
  3. Line 243: zip(columns, t)zip(columns, t, strict=True)
  4. Line 263: zip(df.columns, map(maybe_box_native, t[1:]))zip(df.columns, map(maybe_box_native, t[1:]), strict=True)
  5. Line 275: zip(columns, t[1:])zip(columns, t[1:], strict=True)
  6. Line 282: zip(columns, t[1:])zip(columns, t[1:], strict=True)

Copy link
Contributor Author

invain01 commented Oct 5, 2025

pre-commit.ci autofix

pre-commit-ci[bot] reacted with rocket emoji

@mroeschke mroeschke added the Code Style Code style, linting, code_checks label Oct 5, 2025
@mroeschke mroeschke added this to the 3.0 milestone Oct 5, 2025
@mroeschke mroeschke merged commit 3c17066 into pandas-dev:main Oct 5, 2025
46 checks passed
Copy link
Member

Thanks @invain01

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@mroeschke mroeschke mroeschke approved these changes

Assignees
No one assigned
Labels
Code Style Code style, linting, code_checks
Projects
None yet
Milestone
3.0
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /