-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
executable file
·34 lines (24 loc) · 902 Bytes
/
test.py
File metadata and controls
executable file
·34 lines (24 loc) · 902 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
31
32
33
34
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
df = pd.read_csv('WorldHappinessIndex.csv')
headers = df.columns.values
print(headers)
rank = df.loc[0:,"Happiness Rank"]
score = df.loc[0:,"Happiness Score"]
capita_gdp = df.loc[0:,"Economy (GDP per Capita)"]
health = df.loc[0:,'Health (Life Expectancy)']
trust = df.loc[0:,'Trust (Government Corruption)']
score = (rank - rank.min())/rank.max()
capita_gdp = (capita_gdp - capita_gdp.min())/capita_gdp.max()
health = (health - health.min())/health.max()
trust = (trust- trust.min())/trust.max()
plt.plot(rank,score,label = 'Happines Score')
plt.plot(rank,capita_gdp,label = 'Per Capita GDP')
plt.plot(rank,health,label='Health (Life Expenctancy)')
plt.legend()
plt.xlabel('Happiness Rank')
plt.ylabel('Normalized Index')
plt.figure('Health vs GDP')
plt.plot(capita_gdp,trust)
plt.show()