0

i have a table in pandas df.

id   count
1      1
2      5
3      7
4      9
5      NaN
6      NaN

i want to change count to 1 wherever the count is Nan

df['count'] = 1

this would make all the columns to 1 but i dont want that, is there any way to define if condition in pandas df

Shubham R
  • 7,382
  • 18
  • 53
  • 119

0 Answers0