forked from gzavo/CS_Assignment_old
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_file.py
More file actions
30 lines (23 loc) · 772 Bytes
/
plot_file.py
File metadata and controls
30 lines (23 loc) · 772 Bytes
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
import pandas as pd
import matplotlib.pyplot as plt
pd.options.mode.chained_assignment = None
data1 = pd.read_csv("/Users/Senne/Documents/Senne Bakker/UVA:VU/Seminar/Assignment lec 3/CS_Assignment/istherecorrelation.csv",delimiter=";")
years = data1.iloc[:,0]
# Number of students in terms of thousands
wo = data1.iloc[:,1]
print(wo)
# Beer consumptions in terms of thousands of hectoliters
beer_cons = data1.iloc[:,2]
ratio = []
# convert data
for i in range(len(beer_cons)):
wo[i] = wo[i].replace(',', '.', 1)
wo[i] = float(wo[i])
ratio.append(beer_cons[i]/wo[i])
# plot data
# plt.scatter(years, ratio)
plt.scatter(years, beer_cons)
plt.title("Total beer consumption over the years")
plt.xlabel("Years")
plt.ylabel("Consumption (10^3 hl)")
plt.show()