-
Notifications
You must be signed in to change notification settings - Fork 6
/
visualisation.py
51 lines (34 loc) · 1.04 KB
/
visualisation.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
import pandas as pd
import numpy as np
dataset = pd.read_csv(r'visualisation_dataset.csv')
dataset=dataset.iloc[:,1:]
#Total outages per region
counts = dataset.groupby('Region').size()
#Total outages per week basis
weeks= dataset.groupby('week').size()
outageOnHolidays=np.zeros((len(counts),1))
countD =pd.DataFrame()
countD['Regions']=counts.keys()
countD['Outagesintot'] = counts.values
month=[]
for k in range(0,len(counts)):
for i in range(dataset.shape[0]):
if(dataset['Holiday'][i]==1):
if(dataset['Region'][i]==countD['Regions'][k]):
outageOnHolidays[k]+=1
countD['OOH']=outageOnHolidays
for i in range(0,dataset.shape[0]):
x = dataset['Date'][i]
y = int(x[5:7])
month.append(y)
dataset['Month'] = month
mc = []
for i in range(0,len(counts)):
mc.append(0)
x=[]
for i in range(0,12):
x.append(0)
for i in range(0,len(counts)):
mc[i]=x
#Outages in each region per month
xc=dataset.groupby(['Month','Region']).size()