Suppose this is my dataframe:
In [1]: df = pd.DataFrame(
...: {
...: "A": ["A0", "A1", "A0", "A2", "A3", "A2"],
...: "B": ["B0", "B1", "B4", "B2", "B3", "B5"],
...: }
...: )
Out[1]:
A B
1 A0 B0
2 A1 B1
3 A0 B4
3 A2 B2
4 A3 B3
5 A2 B5
I want to clean this Dataframe based on column A, i.e. keep only one row based on column 'A' and in column 'B' the values should get appended. That is, I want my output to look like this:
Out[2]:
A B
1 A0 B0 B4
2 A1 B1
3 A2 B2 B5
3 A3 B3
The first thing that came to my mind was using Dataframe.duplicated(), but I couldn't figure out how.