how can I sum the values in column \'two\' based on the items in column \'one\' in pandas dataframe:
df = pd.DataFrame({\'One\': [\'A\', \'B\', \'A\', \'B\'], \'
You need to group by the first column and sum on the second.
group by
sum
df.groupby('One', as_index=False).sum() One Two 0 A 4 1 B 9