Skip to content

Conversation

RAAPPO
Copy link
Contributor

@RAAPPO RAAPPO commented Oct 3, 2025

Part of #62434

This PR enforces Ruff rule B905 (zip-without-explicit-strict) by adding explicit strict=True to all zip() calls in pandas/core/frame.py.

Updates made:

  • Updated zip(self.index, self.values) to zip(self.index, self.values, strict=True)
  • Updated zip(*arrays) to zip(*arrays, strict=True)
  • Updated zip(key, value.columns) to zip(key, value.columns, strict=False)
  • Updated zip(cols, cols_droplevel) to zip(cols, cols_droplevel, strict=True)
  • Updated zip(reversed(self.index.levels), reversed(self.index.codes)) to zip(reversed(self.index.levels), reversed(self.index.codes), strict=True)
  • Updated zip(*map(f, vals)) to zip(*map(f, vals), strict=True)
  • Updated zip(keys, by) to zip(keys, by, strict=True)
  • Updated zip(self._iter_column_arrays(), right) to zip(self._iter_column_arrays(), right, strict=True)
  • Updated zip(left.values.T, right.values.T) to zip(left.values.T, right.values.T, strict=True)

Checklist:

  • Part of STY: Enforce Ruff rule B905, zip-without-explicit-strict #62434
  • All code checks passed.
  • Tests added and passed if fixing a bug or adding a new feature.
  • Added type annotations to new arguments/methods/functions.
  • Added an entry in the latest doc/source/whatsnew/vX.X.X.rst file if fixing a bug or adding a new feature.

Please let me know if any changes are needed!

@RAAPPO RAAPPO marked this pull request as ready for review October 3, 2025 04:51
if isinstance(value, DataFrame):
check_key_length(self.columns, key, value)
for k1, k2 in zip(key, value.columns):
for k1, k2 in zip(key, value.columns, 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.

Why is this one False?

@mroeschke mroeschke added the Code Style Code style, linting, code_checks label Oct 3, 2025
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.

2 participants