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): treat literal values consistently in select context, improve related typing #6628

Merged

Conversation

alexander-beedie
Copy link
Collaborator

@alexander-beedie alexander-beedie commented Feb 2, 2023

Closes #6606.

  • Fixes discrepancy between df.select(value) and df.select([value]) - also addresses the same issue when using with_columns.
  • Improves typing/readability by introducing two new type aliases:
    • PolarsExprType
    • PythonLiteral

…one or as part of a list, improve related typing
@github-actions github-actions bot added fix Bug fix python Related to Python Polars labels Feb 2, 2023
Copy link
Member

@stinodego stinodego left a comment

Choose a reason for hiding this comment

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

This is exactly how I envisioned this, but I couldn't manage to wrap my head around this late last night 😄 I left a few comments!

py-polars/polars/internals/dataframe/frame.py Outdated Show resolved Hide resolved
py-polars/polars/internals/dataframe/frame.py Outdated Show resolved Hide resolved
py-polars/polars/internals/type_aliases.py Outdated Show resolved Hide resolved
@alexander-beedie
Copy link
Collaborator Author

alexander-beedie commented Feb 2, 2023

I left a few comments!

You always leave great feedback - will take a look through and tweak accordingly :)

(Update: done)

Copy link
Member

@stinodego stinodego left a comment

Choose a reason for hiding this comment

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

Great!

@ritchie46 ritchie46 merged commit 06c0b54 into pola-rs:master Feb 2, 2023
@alexander-beedie alexander-beedie deleted the literal-select-consistency branch February 2, 2023 10:27
Vincenthays pushed a commit to Vincenthays/polars that referenced this pull request Feb 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Bug fix python Related to Python Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inconsistent behaviour in parsing select arguments
3 participants