-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathverify-major-cities.py
executable file
·207 lines (201 loc) · 5.04 KB
/
verify-major-cities.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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
import pandas as pd
# Read the TSV file
df = pd.read_csv('generated_data/db.tsv', sep='\t')
# Function to check if a city is in the dataframe
def city_in_df(city, country, df):
return ((df['name'] == city) & (df['country_code'] == country.lower())).any()
# Extended list of world capitals and major cities
world_cities = [
("Tokyo", "JP"),
("Delhi", "IN"),
("Shanghai", "CN"),
("São Paulo", "BR"),
("Mexico City", "MX"),
("Cairo", "EG"),
("Mumbai", "IN"),
("Beijing", "CN"),
("Dhaka", "BD"),
("Osaka", "JP"),
("New York", "US"),
("Karachi", "PK"),
("Buenos Aires", "AR"),
("Chongqing", "CN"),
("İstanbul", "TR"),
("Kolkata", "IN"),
("Manila", "PH"),
("Lagos", "NG"),
("Rio de Janeiro", "BR"),
("Tianjin", "CN"),
("London", "GB"),
("Paris", "FR"),
("Bangkok", "TH"),
("Seoul", "KR"),
("Moscow", "RU"),
("Jakarta", "ID"),
("Lima", "PE"),
("Ho Chi Minh City", "VN"),
("Guangzhou", "CN"),
("Shenzhen", "CN"),
("Bangalore Urban", "IN"),
("Kinshasa", "CD"),
("Lahore", "PK"),
("Bogotá D.C.", "CO"),
("Chennai", "IN"),
("Johannesburg", "ZA"),
("Taipei", "TW"),
("Hyderabad", "IN"),
("Dongguan", "CN"),
("Hangzhou", "CN"),
("Hong Kong", "HK"),
("Chengdu", "CN"),
("Nanjing", "CN"),
("Tehran", "IR"),
("Wuhan", "CN"),
("Onitsha", "NG"),
("Ahmedabad", "IN"),
("Kuala Lumpur", "MY"),
("Xi'an", "CN"),
("Harbin", "CN"),
("Surat", "IN"),
("Singapore", "SG"),
("Berlin", "DE"),
("Madrid", "ES"),
("Rome", "IT"),
("Kyiv", "UA"),
("Bucharest", "RO"),
("Vienna", "AT"),
("Hamburg", "DE"),
("Warsaw", "PL"),
("Budapest", "HU"),
("Amsterdam", "NL"),
("Brussels", "BE"),
("Stockholm", "SE"),
("Prague", "CZ"),
("Copenhagen", "DK"),
("Helsinki", "FI"),
("Athens", "GR"),
("Lisbon", "PT"),
("Dublin", "IE"),
("Oslo", "NO"),
("Washington D.C.", "US"),
("Los Angeles", "US"),
("Chicago", "US"),
("Houston", "US"),
("Toronto", "CA"),
("Montreal", "CA"),
("Vancouver", "CA"),
("Sydney", "AU"),
("Melbourne", "AU"),
("Brisbane", "AU"),
("Perth", "AU"),
("Auckland", "NZ"),
("Wellington", "NZ"),
("Cape Town", "ZA"),
("Nairobi", "KE"),
("Addis Ababa", "ET"),
("Khartoum", "SD"),
("Algiers", "DZ"),
("Casablanca", "MA"),
("Tunis", "TN"),
("Accra", "GH"),
("Dakar", "SN"),
("Riyadh", "SA"),
("Jeddah", "SA"),
("Dubai", "AE"),
("Abu Dhabi", "AE"),
("Doha", "QA"),
("Kuwait City", "KW"),
("Muscat", "OM"),
("Manama", "BH"),
("Baghdad", "IQ"),
("Amman", "JO"),
("Beirut", "LB"),
("Damascus", "SY"),
("Jerusalem", "IL"),
("Tel Aviv", "IL"),
("Ankara", "TR"),
("Tashkent", "UZ"),
("Almaty", "KZ"),
("Bishkek", "KG"),
("Dushanbe", "TJ"),
("Ashgabat", "TM"),
("Kabul", "AF"),
("Islamabad", "PK"),
("Kathmandu", "NP"),
("Colombo", "LK"),
("Dhaka", "BD"),
("Yangon", "MM"),
("Phnom Penh", "KH"),
("Vientiane", "LA"),
("Hanoi", "VN"),
("Ulaanbaatar", "MN"),
("Pyongyang", "KP"),
("Taipei", "TW"),
("Manila", "PH"),
("Kuala Lumpur", "MY"),
("Jakarta", "ID"),
("Surabaya", "ID"),
("Bandung", "ID"),
("Port Moresby", "PG"),
("Suva", "FJ"),
("Nouméa", "NC"),
("Honolulu", "US"),
("San Francisco", "US"),
("Seattle", "US"),
("Boston", "US"),
("Miami", "US"),
("Atlanta", "US"),
("Dallas", "US"),
("Phoenix", "US"),
("Philadelphia", "US"),
("San Diego", "US"),
("Detroit", "US"),
("San Jose", "US"),
("Havana", "CU"),
("Santo Domingo", "DO"),
("Port-au-Prince", "HT"),
("San Juan", "PR"),
("Kingston", "JM"),
("Guatemala City", "GT"),
("San Salvador", "SV"),
("Tegucigalpa", "HN"),
("Managua", "NI"),
("San Jose", "CR"),
("Panama", "PA"),
("Caracas", "VE"),
("Quito", "EC"),
("Guayaquil", "EC"),
("Cali", "CO"),
("Medellín", "CO"),
("Brasília", "BR"),
("Salvador", "BR"),
("Fortaleza", "BR"),
("Belo Horizonte", "BR"),
("Manaus", "BR"),
("Curitiba", "BR"),
("Recife", "BR"),
("Porto Alegre", "BR"),
("Montevideo", "UY"),
("Asunción", "PY"),
("La Paz", "BO"),
("Santiago", "CL"),
("Antofagasta", "CL"),
("Valparaíso", "CL"),
]
# Check each city
missing_cities = []
for city, country in world_cities:
if not city_in_df(city, country, df):
missing_cities.append(f"{city}, {country}")
# Print results
if missing_cities:
print("The following major cities are missing from the dataset:")
for city in missing_cities:
print(city)
else:
print("All major cities in the list are present in the dataset.")
# Print some statistics
print(f"\nTotal cities in the dataset: {len(df)}")
print(f"Number of countries represented: {df['country_code'].nunique()}")
print(f"Number of cities checked: {len(world_cities)}")
print(f"Number of missing cities: {len(missing_cities)}")