-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGenUplift.py
34 lines (23 loc) · 887 Bytes
/
GenUplift.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
import subprocess
import os
import pandas as pd
import numpy as np
def process_Uplift(ID):
bashcommand = 'sh file_loop.sh %s' %(ID)
process = subprocess.Popen(bashcommand.split(), stdout=subprocess.PIPE)
output, error = process.communicate()
return
def edit_Uplift(ID,uplift_values):
uplift = pd.read_csv('AUS/%s/AUS_uplift.csv'%(ID))
# print(uplift.shape)
uplift.columns = ['0','uplift_name', 'AUS001']
# uplift.loc[uplift.uplift_name =='Zealandia_Z3_1', 'AUS001'] = 33000
uplift['AUS001'] = uplift_values
uplift.to_csv('AUS/%s/AUS_uplift.csv'%(ID), index=False)
return
def main():
ID = 2
dummy_file = pd.read_csv('AUS/upliftvariables.txt')
print('dummy_file.shape', dummy_file.shape)
edit_Uplift(ID, dummy_file)
if __name__ == "__main__": main()