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

Make ColumnNotFoundError in with_columns as nice as it is in columns from read_csv #18903

Open
MarcoGorelli opened this issue Sep 24, 2024 · 1 comment
Labels
A-exceptions Area: exception handling enhancement New feature or an improvement of an existing feature

Comments

@MarcoGorelli
Copy link
Collaborator

Description

Check this out:

pl.read_csv('fr.csv', columns=['long'])
polars.exceptions.ColumnNotFoundError: unable to find column "long"; valid colum
ns: ["city", "lat", "lng", "country", "iso2", "admin_name", "capital", "populati
on", "population_proper"]

Absolutely beautiful, top-grade error message, love it 😍

Now check this out:

    pl.read_csv('fr.csv')
    .with_columns(
        pastry = name_pastry('lat', 'long')
    )
polars.exceptions.ColumnNotFoundError: long

Much, much less helpful.

Any objections to making this error message as beautiful as the first one?

@MarcoGorelli MarcoGorelli added the enhancement New feature or an improvement of an existing feature label Sep 24, 2024
@ritchie46
Copy link
Member

ritchie46 commented Sep 24, 2024

Certainly not. That goal I can only wholeheartidly encourage (everywhere).

@MarcoGorelli MarcoGorelli added the A-exceptions Area: exception handling label Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-exceptions Area: exception handling enhancement New feature or an improvement of an existing feature
Projects
None yet
Development

No branches or pull requests

2 participants