I’m trying to read a csv file which has ‘NA’ value as data. When I use ‘keep_default_na = false’ option to keep NA values it’s impacting other columns with empty rows.
csv file data.
Here, I want to keep NA values in column ‘city’. I’m reading the file like this.
DF = pandas.read_csv(csv, keep_default_na=False)
Now I can see NA values are being present in DF, but the values in second column ‘price’ are present as string. (’10’,’25’) not as numbers.
This is happening if there is an empty row in a column with numeric values. How can I apply ‘keep_default_na= False’ and still read other values in the same dType?
Suri_362 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.