I've seen all the posts on dropping all the "Na"s in a dataset with df.dropna
but I've found that all of these methods only apply to strings. If I have an object that is "(NA)" how would I convert these to zeros? Thank you!
Asked
Active
Viewed 39 times
0

Daemon Painter
- 3,208
- 3
- 29
- 44

slovakia111
- 1
- 1
-
Hello and welcome to SO. You don't want to _drop_, since that means removing data. You want to substitute your data. Does [this](https://stackoverflow.com/questions/13295735/how-can-i-replace-all-the-nan-values-with-zeros-in-a-column-of-a-pandas-datafram) answer your question? If no, why? If possible, [edit](https://stackoverflow.com/posts/60889982/edit) your question to add a sample of the data you want to manipulate. – Daemon Painter Mar 27 '20 at 17:11
1 Answers
0
Use the function fillna
df['test'] = df.test.fillna(0)
This is will fill the NA values of column "test" with zeros

dp6000
- 473
- 5
- 15