Merging Pandas Dataframes With The Same Column Name
I have a dataset, lets say: Column with duplicates value1 value2 1 5 0 1 0 9 And w
Solution 1:
IIUC, you can use groupby
and then aggregate:
>>> df
Columnwith duplicates value1 value2
01501109
[2rows x 3 columns]
>>> df.groupby("Column with duplicates", as_index=False).sum()
Columnwith duplicates value1 value2
0159
[1rows x 3 columns]
On the OP's updated example:
>>> df
trial Time123401'0-100'01000011'0-100'3200021'100-200'00100032'0-100'010000
[4rows x 6 columns]
>>> df.groupby("trial", as_index=False).sum()
trial 12340132100100012010000
[2rows x 5 columns]
Post a Comment for "Merging Pandas Dataframes With The Same Column Name"