Skip to content
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

fix(python): Address incorrect selector & col expansion #19742

Merged
merged 1 commit into from
Nov 13, 2024

Conversation

alexander-beedie
Copy link
Collaborator

@alexander-beedie alexander-beedie commented Nov 12, 2024

Closes #19740.

Should resolve as an intersection, not a union.

Example

import polars.selectors as cs
import polars as pl

df = pl.DataFrame({
    "a": [1],
    "b": [2]
})

Before

df.select(cs.by_name("a") & pl.col("b"))
# shape: (1, 2)
# ┌─────┬─────┐
# │ a   ┆ b   │
# │ --- ┆ --- │
# │ i64 ┆ i64 │
# ╞═════╪═════╡
# │ 1   ┆ 2   │
# └─────┴─────┘

After

df.select(cs.by_name("a") & pl.col("b"))
# shape: (0, 0)
# ┌┐
# ╞╡
# └┘

@github-actions github-actions bot added fix Bug fix python Related to Python Polars labels Nov 12, 2024
@alexander-beedie alexander-beedie added the A-selectors Area: column selectors label Nov 12, 2024
@ritchie46 ritchie46 merged commit 37ae8e7 into pola-rs:main Nov 13, 2024
16 of 17 checks passed
@alexander-beedie alexander-beedie deleted the selector-and-col branch November 13, 2024 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-selectors Area: column selectors fix Bug fix python Related to Python Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Confusion about & when mixing cs.by_name and pl.col
2 participants