I have the following table (df):
Col1 | Col2 | Col3 |
---|---|---|
A1 | finished | 1234 |
A2 | ongoing | 1235 |
A3 | NaN | 1236 |
A4 | finished | 1237 |
A5 | started | 1238 |
A6 | NaN | 1239 |
I would like to replace the NaNs in the dataframe with empty_row. How do I do that?
Desired output:
Col1 | Col2 | Col3 |
---|---|---|
A1 | finished | 1234 |
A2 | ongoing | 1235 |
A3 | empty_row | 1236 |
A4 | finished | 1237 |
A5 | started | 1238 |
A6 | empty_row | 1239 |
What I tried so far?
if df['col2'] == 'NaN':
df['col2'] = 'empty_row'
I get the following error: ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
How do I solve this?