I would like to combine a DataFrames with same column different row into one based on another column in my Excel. Is there any way to make it possible without using groupby as my data later will need to iterrows.
Example is as below:
df = pd.DataFrame({'date': [16042020, '', '', 17042020,'', '', '', 17042020,'', '', ''],
'des': ['I','am', 'happy','I','am', 'a','butterfly','I','am', 'a', 'girl']})
print (df)
**OUTPUT:**
date des
0 16042020 I
1 am
2 happy
3 17042020 I
4 am
5 a
6 butterfly
7 17042020 I
8 am
9 a
10 girl
Expected Output are as below (based on date):
date des Result
0 16042020 I I am happy
1 am
2 happy
3 17042020 I I am a butterfly
4 am
5 a
6 butterfly
7 17042020 I I am a girl
8 am
9 a
10 girl