I have a data frame like this,
df:
col1 col2 col3
1 cat 4
nan dog nan
3 tiger 3
2 lion 9
nan frog nan
nan elephant nan
I want to create a data frame from this data frame that id there is nan values in col1, col2 values will be added to the previous row value.
for example the desired output data frame will be:
col1 col2 col3
1 catdog 4
3 tiger 3
2 lionfrogelephant 9
How to do this using pandas ?