Browse Source

merge csv rows

bscheibel 5 years ago
parent
commit
18b764b5d0
1 changed files with 3 additions and 2 deletions
  1. 3 2
      merge_pandas.py

+ 3 - 2
merge_pandas.py

@@ -1,4 +1,5 @@
 import pandas
 df = pandas.read_csv('text.csv', header = 0, delimiter=";")
-df['Total'] = df.groupby(['x'])['Text'].transform('sum')
-df.drop_duplicates()
+df['Total'] = df.groupby(['x','y'])['Text'].transform('sum')
+df.drop_duplicates()
+print(df)