I have dataframe file that split text into multiple rows, like:
| A | B |
|---|---|
| aaa | bbbb |
| ccccc | NaN |
| NaN | NaN |
| dddd | ffff |
| eeee | NaN |
| gg | NaN |
I hope to merge the value of each row to its next rows unless it is blank and get a data frame like:
| A | B |
|---|---|
| aaacccc | bbbb |
| ddddeeeegg | ffff |
Is there an efficient way to convert the dataframe in python?