0

I can read a dataframe like this in pandas (it was originally a TAD file): pd.read_csv('/content/drive/MyDrive/Database Nencini/estrapola_articoli.csv', sep='\t', lineterminator='\r') How can I do it using polars library?

coelidonum
  • 523
  • 5
  • 17

1 Answers1

2

Check the documentation here: scan_csv. There are separator and eol_char arguments that can be used if needed. Equivalent code:

import polars as pl

df = pl.scan_csv('/content/drive/MyDrive/Database Nencini/estrapola_articoli.csv',
                 separator='\t',
                 eol_char='\r',
                 )

I'd be tempted to try it without eol_char first.

If you want to read the whole file at once into memory (bad idea, your other post said it was huge), you can use read_csv() instead.

Pep_8_Guardiola
  • 5,002
  • 1
  • 24
  • 35