Skip to content

Load CSV without replacing empty value to nan

In pandas the usual pd.read_csv load the CSV and replacing empty values to nan. If that needs to be override, pandas has the boolean option keep_default_na. If it is False then the pandas won't apply nan on the data

Example

import pandas as pd
pd.read_csv("/tmp/data.csv", keep_default_na=False)

For more ref: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_csv.html

Back to top