forked from CommonsBuild/tec-rewards
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcombine_diffs.py
38 lines (22 loc) · 889 Bytes
/
combine_diffs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import pandas as pd
import os, sys
PATH = "./distribution_rounds"
folders = os.listdir(PATH)
combined_df = pd.DataFrame()
for folder in folders:
try:
filename = PATH + "/" + folder + "/praise_aragon_distribution.diff-1-2.csv"
test = pd.read_csv(filename,header=None)
combined_df = combined_df.append(test, ignore_index=True)
print(folder + " success")
except:
print("error in folder" + folder)
grouped_df = combined_df.groupby([0])
aragon_df = pd.DataFrame(columns=["address", "amount", "token"])
for name, group in grouped_df:
#print(name)
#print(group[1].sum())
aragon_df.loc[len(aragon_df.index)] = [name, group[1].sum(), "TEC"]
aragon_df.sort_values(by="amount", ascending=False, ignore_index=True, inplace=True)
print(aragon_df)
aragon_df.to_csv("aragon_combined_diff_1-16.csv", index=False, header=False)