The data
reads information from a txt file, and it includes some nan values. I try to replace all nan with zero using data.replace('nan', 0)
. But the nan values in the series cannot be found.
file = 'RAO.txt'
data = pd.read_csv(file, sep="t", header=None, skiprows=1)
data = data.drop(data.columns[-1], axis=1)
print(data)
print(data.isnull())
The output of above code is
As shown, isnull() is unable to find nan in data
. Does anyone know how to solve this problem? Thanks!
1
If Nan is actually present, it seems that there is too much data and the ‘True’ value is not seen.
You can check how many Nan there are with print(data.isnull().sum())
Jw J is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.