-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathusage-analisys.py
49 lines (38 loc) · 1.37 KB
/
usage-analisys.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
#!/usr/bin/python
import csv
import pprint
import pandas as pd
tbl = dict()
with open('year-month-nimbus.csv') as csvfile:
readCSV = csv.reader(csvfile, delimiter=',')
for row in readCSV:
dstart = str(row[0]) + '-' + str(row[1]) + '-' + str(row[2])
year_month = str(row[0]) + '-' + str(row[1])
data_csv = "servers-" + dstart + ".csv"
tbl[year_month] = dict()
with open(data_csv) as dcsv:
rcsv = csv.reader(dcsv, delimiter=',')
for l in rcsv:
if l[0] == 'Project':
continue
print l[0], year_month, l[1]
tbl[year_month][l[0]] = l[1]
df = pd.DataFrame(tbl)
df.to_csv('os-table-instances.csv')
tbl = dict()
with open('year-month-nimbus.csv') as csvfile:
readCSV = csv.reader(csvfile, delimiter=',')
for row in readCSV:
dstart = str(row[0]) + '-' + str(row[1]) + '-' + str(row[2])
year_month = str(row[0]) + '-' + str(row[1])
data_csv = "cpus-" + dstart + ".csv"
tbl[year_month] = dict()
with open(data_csv) as dcsv:
rcsv = csv.reader(dcsv, delimiter=',')
for l in rcsv:
if l[0] == 'Project':
continue
print l[0], year_month, l[1]
tbl[year_month][l[0]] = l[1]
df = pd.DataFrame(tbl)
df.to_csv('os-table-cpus.csv')