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

read_excel (calamine engine) Boolean schema override not working #17407

Closed
2 tasks done
darrylthom opened this issue Jul 3, 2024 · 2 comments · Fixed by #17448
Closed
2 tasks done

read_excel (calamine engine) Boolean schema override not working #17407

darrylthom opened this issue Jul 3, 2024 · 2 comments · Fixed by #17448
Assignees
Labels
A-io-spreadsheet Area: reading/writing Excel/ODS files bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars

Comments

@darrylthom
Copy link

Checks

  • I have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest version of Polars.

Reproducible example

   read_excel('Test.xlsx', engine='calamine', sheet_name='Sheet1', infer_schema_length=None, schema_overrides={'NAME': pl.String, 'IS_ACTIVE': pl.Boolean})

Log output

_fastexcel.InvalidParametersError: invalid parameters: unsupported dtype: "bool"

Issue description

When reading in an Excel column that is TRUE/FALSE (booleans used within an Excel workbook) and explicitly defining it as a pl.Boolean, it throws an unsupported dtype error. I've had to instead read this in as a pl.UInt8 and cast it to a Boolean after its read in as a workaround.

Expected behavior

I would expect it to allow me to explicitly define a column as a boolean when reading in the Excel file without throwing an error.

Installed versions

Replace this line with the output of pl.show_versions(). Leave the backticks in place.
polars 1.0 Also broken in 0.2 as well
@darrylthom darrylthom added bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars labels Jul 3, 2024
@alexander-beedie alexander-beedie self-assigned this Jul 3, 2024
@stinodego stinodego added the A-io-spreadsheet Area: reading/writing Excel/ODS files label Jul 3, 2024
@alexander-beedie
Copy link
Collaborator

@KingDarule: fixed - available in the just-released Polars 1.1.0.
Give it a go?

@darrylthom
Copy link
Author

It works -- thanks for the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-io-spreadsheet Area: reading/writing Excel/ODS files bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants