shshemi / tabiew

A lightweight TUI application to view and query tabular data files, such as CSV, TSV, or parquet.
MIT License
541 stars 14 forks source link

error opening a csv #2

Closed deliro closed 6 months ago

deliro commented 6 months ago

Hi! Thank you for this awesome tool! Looking forward to use it on a daily basis.

I got an error while opening a csv with big numbers (which are actually strings):

~/Desktop ❯ tw kbks.csv           
Error: ComputeError(ErrString("could not parse `18210102010011000110` as dtype `i64` at column 'code' (column number 3)\n\nThe current offset in the file is 29 bytes.\n\nYou might want to try:\n- increasing `infer_schema_length` (e.g. `infer_schema_length=10000`),\n- specifying correct dtype with the `dtypes` argument\n- setting `ignore_errors` to `True`,\n- adding `18210102010011000110` to the `null_values` list.\n\nOriginal error: ```remaining bytes non-empty```"))

I guess this error is from polars that's trying to parse 18210102010011000110 as an i64 integer.

Attaching the problem file: kbks.csv

shshemi commented 6 months ago

The problem should be fixed in version 0.3.0. However, in your case, you need to use --infer-schema no to disable schema inference or --infer-schema safe to make the operation safe.

Let me know if the problem is solved.

deliro commented 6 months ago

I'm not sure I got you right. Trying to do this in several ways, no luck:

~/projects/tochka/screpka/skrepka/taxcalc/tables beta *12 ❯ tw --infer-schema no kbks.csv                                               
error: unexpected argument '--infer-schema' found

  tip: to pass '--infer-schema' as a value, use '-- --infer-schema'

Usage: tw <FILE_NAME>

For more information, try '--help'.
~/projects/tochka/screpka/skrepka/taxcalc/tables beta *12 ❯ tw --infer-schema=no kbks.csv                                           
error: unexpected argument '--infer-schema' found

  tip: to pass '--infer-schema' as a value, use '-- --infer-schema'

Usage: tw <FILE_NAME>

For more information, try '--help'.
~/projects/tochka/screpka/skrepka/taxcalc/tables beta *12 ❯ tw -- --infer-schema=no kbks.csv                                        
error: unexpected argument 'kbks.csv' found

Usage: tw <FILE_NAME>

For more information, try '--help'.
~/projects/tochka/screpka/skrepka/taxcalc/tables beta *12 ❯ tw kbks.csv -- --infer-schema=no                                        
error: unexpected argument '--infer-schema=no' found

Usage: tw <FILE_NAME>

For more information, try '--help'.

~/projects/tochka/screpka/skrepka/taxcalc/tables beta *12 ❯ tw kbks.csv --infer-schema=no                                               
error: unexpected argument '--infer-schema' found

  tip: to pass '--infer-schema' as a value, use '-- --infer-schema'

Usage: tw <FILE_NAME>

For more information, try '--help'.
shshemi commented 6 months ago

First, make sure you have the latest version of Tabiew installed:

tw --version

then, you may open kbks.csv via the following commands:

tw kbks.csv --infer-schema no

and

tw kbks.csv --infer-schema safe

Let me know if the problem is solved.