csvs-to-sqlite icon indicating copy to clipboard operation
csvs-to-sqlite copied to clipboard

Add option to pass na_filter into pd.read_csv() - Dealing with CSV containing NA as string

Open dazzag24 opened this issue 6 years ago • 1 comments

I have a CSV detailing info about airports. The country code column is encoded using 2 character ISO-3166 codes. https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes

It turns out that the code for Namibia is "NA" and this results in the values being stripped as it converts from CSV to SQLite DB.

I was able to solve this by adding na_filter=False to the pd.read_csv() call in utils.py https://github.com/simonw/csvs-to-sqlite/blob/dccbf65b37bc9eed50e9edb80a42f257e93edb1f/csvs_to_sqlite/utils.py#L24

Would you consider adding an option to allow this flag to be passed into the pd.read_csv call?

Thanks Darren

dazzag24 avatar Jan 08 '19 19:01 dazzag24

I agree, I have the same issue.

frafra avatar May 26 '22 22:05 frafra