pandas read_csv and setting na_values to any string in the csv file [duplicate]
问题 This question already has answers here : Pandas: Converting to numeric, creating NaNs when necessary (4 answers) Closed 2 years ago . data.csv 1, 22, 3432 1, 23, \N 2, 24, 54335 2, 25, 3928 I have a csv file of data that is collected from a device. Every now and then the device doesn't relay information and outputs '\N'. I want to treat these as NaN and did this by doing read_csv(data.csv, na_values=['\\N']) which worked fine. However, I would prefer to have not only this string turned to NaN