79377589

Date: 2025-01-22 11:52:54
Score: 0.5
Natty:
Report link

It works if defining calamine/fastexcel datatypes to strings as below, and then selecting the specified columns and transforming to desired dtypes in pl.select, but perhaps there are better ways than this.

pl.read_excel(
    source=xlsx_file_path,
    sheet_name="name_of_the_sheet",
    read_options={
        "dtypes": "string", # Read all excel columns as strings
    },
).select(
    pl.col("apple_column"),
    pl.col("banana_column"),
    pl.col("kiwi_column"),
)
Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: miroslaavi