I would like to delete every row that contains 0 in order to have cleaner data. However as you can see on the image it shows that 0 is not a null value. Can you guys help me on this? Thank you.
Asked
Active
Viewed 319 times
3 Answers
0
Well, when you are trying df.replace(0,'NA') you are subbing in the string value of NA which is not NULL.
You can just use np.nan there like : df.replace(0,np.nan) [with import numpy as np]
Partha Mandal
- 1,311
- 6
- 13
0
By using a replace, you might want to use the following:
df.replace(0, np.nan).dropna()
It basically replaces zeroes by np.nan wich can be eliminated by pandas' .dropna()
Hugolmn
- 1,430
- 1
- 5
- 19