Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

use_columns silently skips empty columns at the beginning #303

Open
jsarbach opened this issue Oct 15, 2024 · 1 comment
Open

use_columns silently skips empty columns at the beginning #303

jsarbach opened this issue Oct 15, 2024 · 1 comment
Labels

Comments

@jsarbach
Copy link

Given the following spreadsheet with an empty first column:
image

Loading the sheet with e.g. use_columns='B:C' (or use_columns=[1, 2]) actually selects columns C and D:

read_excel('sheet.xlsx').load_sheet(0, use_columns='B:C').to_polars()
shape: (3, 2)
┌────────┬───────┐
│ SecondThird │
│ ------   │
│ f64f64   │
╞════════╪═══════╡
│ 4.07.0   │
│ 5.08.0   │
│ 6.09.0   │
└────────┴───────┘

And raises ColumnNotFoundError with use_columns='B:D' or use_columns=[1, 2, 3]:

read_excel('sheet.xlsx').load_sheet(0, use_columns='B:D').to_polars()
_fastexcel.ColumnNotFoundError: column at index 3 not found
Context:
    0: available columns are: [ColumnInfo { name: "First", index: 0, dtype: Float, column_name_from: LookedUp, dtype_from: Guessed }, ColumnInfo { name: "Second", index: 1, dtype: Float, column_name_from: LookedUp, dtype_from: Guessed }, ColumnInfo { name: "Third", index: 2, dtype: Float, column_name_from: LookedUp, dtype_from: Guessed }]
@PrettyWood
Copy link
Member

Yes the engine behind fastexcel calamine skips empty columns by default.
I plan to add an option on calamine directly like I did for skipping empty rows

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants