I have a dataframe that have a column that looks like:
note
129.0
130.0
131.0
132.0
133.0
134.0
135.0
136.0
137.0
138.0
139.0
140.0
141.0
142.0
143.0
So there are the rows that don't contain the values (NaN). I'de like to replace the numerical values that are not NaN by 1, to have:
note
1
1
1
1
1
1
1
1
I tried this code:
def replace():
if (pd.notnull(df['note'])):
df['note'] = '1'
return df
return df
it returns me ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().