https://pandas.pydata.org/pandas-docs/stable/reference/api/p...
https://pandas.pydata.org/pandas-docs/stable/reference/api/p...
And I've used them all.
And the figuring out of encoding is also complex [2].
Once again, this is just to demonstrate that writing your own CSV parser from scratch is a total waste of time. Just use tools provided by your language. Many languages provide native support for CSV parsing. For example see docs for Microsoft C# [3].
----------
[1] https://github.com/pandas-dev/pandas/blob/v1.0.3/pandas/io/p...
[2] https://github.com/pandas-dev/pandas/blob/v1.0.3/pandas/io/p...
[3] https://docs.microsoft.com/en-us/dotnet/csharp/programming-g...
If you don’t want to use third-party libraries then TextFieldParser[0] is part of the .NET framework.
I use CsvHelper[1] in my projects. It can do pretty much anything although the newer versions have some dependencies.
[0] https://docs.microsoft.com/en-us/dotnet/api/microsoft.visual...
Data.table’s fread is leagues ahead of pandas.
https://www.rdocumentation.org/packages/data.table/versions/...
Fread has automatic footer detection and has automatic skip logic to help parse out mangled headers in some csvs.
I also use fwrite to send it back to the shell to continue my processing pipeline.
https://www.rdocumentation.org/packages/data.table/versions/...
It's mind boggling how little fanfare data.table has despite it being the best way to handle tabular data in 2020.
Getting the parts that work with CSVs to "just work" when presented with an arbitrary CSV file has been super interesting - even with Pandas at our disposal.
https://github.com/bluelabsio/records-mover/blob/d18ec02fdf5...
I wrote up some of the experience here:
https://github.com/bluelabsio/records-mover/blob/master/docs...
import csv
never failed to do everything I needed, what does this Panda thing add?