Skip to content Skip to sidebar Skip to footer

Is This Correct Behavior For Read_csv And A Data Value Of Na?

(I have opened an issue at GitHub.) The following behavior doesn't seem correct to me. It seems like if the default for read_csv is na_values=False then no values including 'NA' s

Solution 1:

You need keep_default_na=False, by default any strings you include in na_values are just added to the standard set of NA strings, e.g. NA, NaN:

pd.read_csv('foo.txt', keep_default_na=False)
Out[5]: 
     x    y
0   NA   NA
1  foo  foo

Post a Comment for "Is This Correct Behavior For Read_csv And A Data Value Of Na?"