[Python] Use polars' read_excel method to read data in xlsx format, a ComputeError was reported

Discussão em 'Python' iniciado por Stack, Março 27, 2025.

  1. Stack

    Stack Membro Participativo

    the code is simple:

    df_pl = pl.read_excel("./data/data-0806.xlsx")


    then raise ComputeError:

    ComputeError: Could not parse `liaozl` as dtype `i64` at column 'cust_no' (column number 93).
    The current offset in the file is 5603524 bytes.

    You might want to try:
    - increasing `infer_schema_length` (e.g. `infer_schema_length=10000`),
    - specifying correct dtype with the `dtypes` argument
    - setting `ignore_errors` to `True`,
    - adding `liaozl` to the `null_values` list.

    Continue reading...

Compartilhe esta Página