forked from kazzastic/CV
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSCIT_maybe.py
41 lines (31 loc) · 1.05 KB
/
SCIT_maybe.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
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 15 01:52:58 2019
@author: kazzastic
"""
import numpy as np
import os
import tarfile
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
data = pd.read_csv('SCIT dataset.csv', index_col = 0)
transport = ['Van', 'Public', 'Car', 'Bike', 'Walk']
y_pos = np.arange(len(transport))
freq = [[]]
for i in range(1,6):
trans = data[data['X3']==i]
freq[i-1].append(len(trans[(trans['X2'] >= 1) & (trans['X2'] <= 10)]))
freq[i-1].append(len(trans[(trans['X2'] >= 11) & (trans['X2'] <= 20)]))
freq[i-1].append(len(trans[(trans['X2'] >= 21) & (trans['X2'] <= 30)]))
freq[i-1].append(len(trans[(trans['X2'] >= 31) & (trans['X2'] <= 45)]))
freq[i-1].append(len(trans[trans['X2'] > 45]))
freq.append([])
freq.pop(5)
#frq = [[freq[j][i] for j in range(len(freq))] for i in range(len(freq[0]))]
plt.bar(y_pos-0.3,freq[0],width = 0.2)
plt.bar(y_pos-0.1,freq[1],width = 0.2)
plt.bar(y_pos+0.1,freq[2],width = 0.2)
plt.bar(y_pos+0.3,freq[3],width = 0.2)
plt.show()