-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun.py
30 lines (27 loc) · 898 Bytes
/
run.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
import pandas as pd
from handler_x2 import handle_x2
from handler_x3 import handle_x3
from handler_x4 import handle_x4
Flag = True
if __name__ == '__main__':
for file_name in ['data/X2.csv', 'data/X3.csv', 'data/X4.csv']:
data = pd.read_csv(file_name)
if 'name' not in data.columns:
if 'source' not in data.filter(
['instance_id']).sample(1).values[0][0]:
output = handle_x2(data)
else:
output = handle_x3(data)
else:
output = handle_x4(data)
if Flag:
output.to_csv("output.csv", sep=',', encoding='utf-8', index=False)
Flag = False
else:
output.to_csv(
"output.csv",
mode='a',
sep=',',
encoding='utf-8',
index=False,
header=None)