I have a following Dataframe in Pandas:
C1 C2 C3 C4
2021 4 1X "First text "
2021 NaN NaN "continued"
2021 NaN NaN "still Continued"
2021 5 1Y "second text"
2021 NaN NaN "continued"
I want to convert this to a Dataframe as follows:
C1 C2 C3 C4
2021 4 1X "First text continued still continued"
2021 5 1Y "second text continued"
That is, I want to merge the rows of C4 column into a single row until a new value comes in C2 and C3 columns. Is there any efficient way to do it? Thanks!