Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23160

Python Polars: How to skip empty line in the CSV file using pl.scan()

$
0
0

Python Polars: How to skip empty line in the CSV file using pl.scan()?

df=pl.scan_csv('c:/test.tab', separator='\t', skip_rows=2)print(df)

c:/test.tab(delimiter is tab space)

row1 : V5 test filerow2 : row3 : Date filename    countrow4 : 16-FEB-23    test123.csv 120row5 : 17-FEB-23    sample111.csv   100row6 : 18-FEB-23    abcd12.csv  12

Issue:

  1. It was skipping the row4 and produce row5 & row6 only when we use skip_rows=2.
  2. However tried to use skip_rows=1 then It does not recognize the columns at row3 because it checking at row2 as header.

Viewing all articles
Browse latest Browse all 23160

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>