Skip to content

FIX avoid polars deprecation warning in PolarsAdapter.hstack - #34447

Merged
ogrisel merged 2 commits into
scikit-learn:mainfrom
fhoehle:fh.fix-polars-horizontal-concat-deprecation
Jul 13, 2026
Merged

ogrisel merged 2 commits into
scikit-learn:mainfrom
fhoehle:fh.fix-polars-horizontal-concat-deprecation

Conversation

@fhoehle

@fhoehle fhoehle commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

polars >= 1.42.1 deprecates pl.concat(..., how="horizontal") in favor of how="horizontal_extend" ahead of removal in polars 2.0 (pola-rs/polars#27927). Use the new variant when available so set_output(transform="polars") doesn't emit a DeprecationWarning.

Reference Issues/PRs

None, since it is a minimal change and polars=1.42.1 emitting the deprecation warnings was released June 30th.
Related to pola-rs/polars#27927 (upstream deprecation that this PR guards against).

What does this implement/fix? Explain your changes.

PolarsAdapter.hstack used by set_output(transform="polars") executes pl.concat(..., how="horizontal"). Polars is deprecating the implicit non-strict behavior of how="horizontal" starting in 1.42.1, and plans to remove it in polars=2.0. The new how="horizontal_extend" variant is the successor of the polars<=1.42.0 variant how="horizontal". Currently every polars-output pipeline will start emitting a DeprecationWarning once users upgrade polars. Since polars<=1.42.0 does not provide how="horizontal_extend" switching of the key word argument value is necessary.

First time contributor introduction

I used scikit-learn for years as part of my day-to-day work and switched recently to using polars. Afterwards my tests flooded me with above deprecation warnings originating from thehstack function of the PolarsAdapter.

AI usage disclosure

I used AI assistance for:

  • Research and understanding

Any other comments?

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown

Thank you for opening your first pull request to scikit-learn! 🎉

To help get your contribution reviewed, please make sure that:

  • You have filled out the pull request template.
  • The pull request addresses an existing issue that is ready for
    contribution (e.g. not tagged as "Needs Triage", "Needs Decision", ...).
    If you are proposing a new feature, please open an issue to discuss it first.
  • There are no other open pull requests already targeting the same issue.
  • You have followed the pull request checklist.
    In particular, linting and tests should pass.

@fhoehle fhoehle changed the title FIX avoid polars deprecation warning in PolarsAdapter.hstack Fix avoid polars deprecation warning in PolarsAdapter.hstack Jul 8, 2026
@fhoehle fhoehle changed the title Fix avoid polars deprecation warning in PolarsAdapter.hstack FIX avoid polars deprecation warning in PolarsAdapter.hstack Jul 8, 2026

@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. Could you please just document the fix in a towncrier entry under doc/whats_new/upcoming_changes? See the readme in that folder for details.

fhoehle added 2 commits July 10, 2026 20:25
polars >= 1.42.1 deprecates `pl.concat(..., how="horizontal")` in favor
of `how="horizontal_extend"` ahead of removal in polars 2.0
(pola-rs/polars#27927). Use the new variant when available so
`set_output(transform="polars")` doesn't emit a DeprecationWarning.
@fhoehle
fhoehle force-pushed the fh.fix-polars-horizontal-concat-deprecation branch from c430dbf to 39766e5 Compare July 10, 2026 19:20
@ogrisel
ogrisel merged commit 667a54c into scikit-learn:main Jul 13, 2026
33 checks passed
@fhoehle
fhoehle deleted the fh.fix-polars-horizontal-concat-deprecation branch July 14, 2026 08:13
prady0t pushed a commit to prady0t/scikit-learn that referenced this pull request Sep 2, 2026
@jeremiedbb jeremiedbb mentioned this pull request Sep 8, 2026
14 tasks done
jeremiedbb pushed a commit to jeremiedbb/scikit-learn that referenced this pull request Sep 9, 2026
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.

2 participants