-
Notifications
You must be signed in to change notification settings - Fork 47
/
Copy pathwhere.py
115 lines (100 loc) · 3.98 KB
/
where.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# -*- coding: utf-8 -*-
import pandas as pd
df = pd.read_csv("city/output/list_of_countries.csv")
your_country = input("What is your country? ")
your_purchasing_power_index = float(
df[df.country == your_country]["purchasing_power_index"]
)
print(f"In your country purchasing power index is {your_purchasing_power_index}")
your_purchasing_power_index = (
input("What is your purchasing power index (higher is better)? ")
or your_purchasing_power_index
)
your_safety_index = float(df[df.country == your_country]["safety_index"])
print(f"In your country safety index is {your_safety_index}")
your_safety_index = (
input("What is your safety index (higher is better)? ") or your_safety_index
)
your_health_care_index = float(df[df.country == your_country]["health_care_index"])
print(f"In your country health care index is {your_health_care_index}")
your_health_care_index = (
input("What is your health care index (higher is better)? ")
or your_health_care_index
)
your_climate_index = float(df[df.country == your_country]["climate_index"])
print(f"In your country climate index is {your_climate_index}")
your_climate_index = (
input("What is your climate index (higher is better)? ") or your_climate_index
)
your_cost_of_living_index = float(
df[df.country == your_country]["cost_of_living_index"]
)
print(f"In your country cost of living index is {your_cost_of_living_index}")
your_cost_of_living_index = (
input("What is your cost of living index (lower is better)? ")
or your_cost_of_living_index
)
your_property_price_to_income_ratio = float(
df[df.country == your_country]["property_price_to_income_ratio"]
)
print(
f"In your country house "
f"price to income ratio index is {your_property_price_to_income_ratio}"
)
your_property_price_to_income_ratio = (
input("What is your house price to income ratio (lower is better)? ")
or your_property_price_to_income_ratio
)
your_traffic_commute_time_index = float(
df[df.country == your_country]["traffic_commute_time_index"]
)
print(
f"In your country traffic commute time index is {your_traffic_commute_time_index}"
)
your_traffic_commute_time_index = (
input("What is your traffic commute time index (lower is better)? ")
or your_traffic_commute_time_index
)
your_pollution_index = float(df[df.country == your_country]["pollution_index"])
print(f"In your country pollution index is {your_pollution_index}")
your_pollution_index = (
input("What is your pollution index (lower is better)? ") or your_pollution_index
)
values = {
"purchasing_power_index": 200,
"safety_index": 200,
"health_care_index": 200,
"cost_of_living_index": 0,
"property_price_to_income_ratio": 0,
"traffic_commute_time_index": 0,
"pollution_index": 0,
"climate_index": 200,
}
df = df.fillna(value=values)
your_purchasing_power_index = float(your_purchasing_power_index)
your_safety_index = float(your_safety_index)
your_health_care_index = float(your_health_care_index)
your_cost_of_living_index = float(your_cost_of_living_index)
your_property_price_to_income_ratio = float(your_property_price_to_income_ratio)
your_traffic_commute_time_index = float(your_traffic_commute_time_index)
your_pollution_index = float(your_pollution_index)
your_climate_index = float(your_climate_index)
out_df = df[df.purchasing_power_index > your_purchasing_power_index][
df.safety_index > your_safety_index
][df.health_care_index > your_health_care_index][
df.cost_of_living_index < your_cost_of_living_index
][
df.property_price_to_income_ratio < your_property_price_to_income_ratio
][
df.traffic_commute_time_index < your_traffic_commute_time_index
][
df.pollution_index < your_pollution_index
][
df.climate_index > your_climate_index
]
print_out_df = out_df[["country", "freedomhouse_score", "quality_of_life_index"]]
if print_out_df.empty:
print(f"Don't exist country better any {your_country}.")
else:
with pd.option_context("display.max_rows", None, "display.max_columns", None):
print(print_out_df)