-
Notifications
You must be signed in to change notification settings - Fork 0
/
csv stuff printing.py
55 lines (47 loc) · 2.22 KB
/
csv stuff printing.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# -*- coding: utf-8 -*-
"""
Created on Sat Jul 28 23:29:04 2018
@author: makerspace-4
"""
import pandas as pd
import csv
import numpy as np
ScoreShit = obs.observation.score_cumulative
indices = ['score','idle_production_time','idle_worker_time','total_value_units','total_value_structures',
'killed_value_units','killed_value_structures','collected_minerals',
'collected_vespene','collection_rate_minerals','collection_rate_vespene',
'spent_minerals','spent_vespene']
#ScoreShit = [354,2345,356,3456,346,567,4567,4567,47,235,345,356,456]
data = pd.DataFrame(columns=indices)
score = []
idlept = []
idlewt = []
totalvt = []
totalvs = []
killedvu = []
killedvs = []
collectedmins= []
collectedves =[]
collectionrtm = []
collectionrtv = []
spentmin = []
spentvesp = []
thinglist = [score,idlept,idlewt,totalvt,totalvs,killedvu,killedvs,collectedmins,
collectedves,collectionrtm,collectionrtv,spentmin,spentvesp]
for i in range(len(thinglist)):
thinglist[i].append(ScoreShit[i])
###### NOTICE: the commented part you have to run the first time then recomment it after the first time
###### because it formats the csv file, you should comment out the bottom part when you run the code for
###### the first time
'''
new_d = data.append(pd.Series(thinglist, index=indices),ignore_index=True)
data = data.append(new_d, ignore_index=True)
print(data)
#data.to_csv("SCtest.csv",mode = 'a', index = False)
data.to_csv("SCtest.csv",mode = 'w', index = False)
'''
###run this part second to infinite times
csvfile = 'SCtest.csv'
with open(csvfile, "a") as output:
writer = csv.writer(output,lineterminator=',')
writer.writerows(thinglist)