Skip to content

MNT: Use Polars in test_get_column_indices_interchange - #31095

Merged
ogrisel merged 3 commits into
scikit-learn:mainfrom
MarcoGorelli:polars-interchange
Mar 31, 2025
Merged

ogrisel merged 3 commits into
scikit-learn:mainfrom
MarcoGorelli:polars-interchange

Conversation

@MarcoGorelli

@MarcoGorelli MarcoGorelli commented Mar 27, 2025 •

Copy link
Copy Markdown
Contributor

Reference Issues/PRs

What does this implement/fix? Explain your changes.

This PR uses Polars for the test_get_column_indices_interchange test. That test currently uses pandas, but kind of pretends that it's not in order to trigger the interchange protocol path.

Given that:

  • scikit-learn is only using the dataframe interchange protocol for Polars/PyArrow support (and not for pandas support - if the interchange protocol were removed from pandas, then no other test would fail)
  • the protocol might be deprecated in pandas

I'd suggest to not use pandas for this test.

Any other comments?

@github-actions

github-actions Bot commented Mar 27, 2025 •

Copy link
Copy Markdown

✔️ Linting Passed

All linting checks passed. Your pull request is in excellent shape! ☀️

Generated for commit: b3869c3. Link to the linter CI: here

@thomasjpfan thomasjpfan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two questions:

  • Can we remove MockDataFrame if we are using polars?
  • Do you see polars removing interchange as well?

Comment thread sklearn/utils/tests/test_indexing.py Resolved
@MarcoGorelli

Copy link
Copy Markdown
Contributor Author

thanks for your review!

  • sure, I've removed the mocked dataframe class
  • so long as scikit-learn uses the protocol, I can't see Polars removing it

@ogrisel ogrisel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. The test is simpler this way.

@ogrisel
ogrisel enabled auto-merge (squash) March 31, 2025 16:24
@ogrisel
ogrisel merged commit e146da1 into scikit-learn:main Mar 31, 2025
lucyleeow pushed a commit to lucyleeow/scikit-learn that referenced this pull request Apr 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants