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(..., engine="calamine") returns column as all-null if first item is null #14224

Closed
2 tasks done
mcrumiller opened this issue Feb 2, 2024 · 3 comments
Closed
2 tasks done
Labels
A-io-spreadsheet Area: reading/writing Excel/ODS files bug Something isn't working python Related to Python Polars

Comments

@mcrumiller
Copy link
Contributor

mcrumiller commented Feb 2, 2024

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

import polars as pl

pl.DataFrame({
    "a": [1, 2, 3],
    "b": [None, 2, 3],
}).write_excel("test.xlsx")

print(pl.read_excel("test.xlsx", engine="calamine"))
shape: (3, 2)
┌─────┬──────┐
│ a   ┆ b    │
│ --- ┆ ---  │
│ i64 ┆ null │
╞═════╪══════╡
│ 1   ┆ null │
│ 2   ┆ null │
│ 3   ┆ null │
└─────┴──────┘

Log output

No response

Issue description

When calamine engine is used, if a column has no data in the first row, the entire column is returned as null.

Expected behavior

Should return column values.

Installed versions

--------Version info---------
Polars:               0.20.6
Index type:           UInt32
Platform:             Windows-10-10.0.19045-SP0
Python:               3.11.7 (tags/v3.11.7:fa7a6f2, Dec  4 2023, 19:24:49) [MSC v.1937 64 bit (AMD64)]

----Optional dependencies----
adbc_driver_manager:  <not installed>
cloudpickle:          <not installed>
connectorx:           0.3.2
deltalake:            <not installed>
fsspec:               <not installed>
gevent:               <not installed>
hvplot:               <not installed>
matplotlib:           3.8.2
numpy:                1.26.2
openpyxl:             3.1.2
pandas:               2.1.4
pyarrow:              14.0.1
pydantic:             <not installed>
pyiceberg:            <not installed>
pyxlsb:               <not installed>
sqlalchemy:           2.0.23
xlsx2csv:             0.8.1
xlsxwriter:           3.1.9
@mcrumiller mcrumiller added bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars labels Feb 2, 2024
@mcrumiller
Copy link
Contributor Author

@alexander-beedie

@deanm0000
Copy link
Collaborator

I think fastexcel already has a PR to fix this here ToucanToco/fastexcel#164

Either way I think it'd be their issue not polars.

@deanm0000 deanm0000 added A-io-spreadsheet Area: reading/writing Excel/ODS files and removed needs triage Awaiting prioritization by a maintainer labels Feb 2, 2024
@mcrumiller
Copy link
Contributor Author

@deanm0000 you're right.

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 python Related to Python Polars
Projects
None yet
Development

No branches or pull requests

2 participants