The old script was skipping row 1 and inserting it as a header, and then replacing the header with new_columns.
When has_header=False is specified, it fixes the row deletion issue but then reads the final comma of the .crv file as an additional column. Thus, df.select is needed to ignore that column.
I also replaced the while loop with the inbuilt comment_char = # from the Polars documentation, which is handy.
The old script was skipping row 1 and inserting it as a header, and then replacing the header with new_columns.
When
has_header=False
is specified, it fixes the row deletion issue but then reads the final comma of the .crv file as an additional column. Thus, df.select is needed to ignore that column.I also replaced the while loop with the inbuilt comment_char = # from the Polars documentation, which is handy.