python'da gerekli kütüphaneleri kullanarak şehirlerin önemli verilerini analiz edip city_rank ve city_total_score (city_total_score 0 ve 5 arasında) verisini oluşturan python scripti yaz bu veriler eklenmiş bir şekilde appendCity.json dosyasını oluştur. en iyi python kütüphanelerini kullanarak gelişmiş bir şekilde yap. Sadece scores verilerini kullanmadan BIAS atayıp hesaplama yap.

import pandas as pd
from colorama import Fore, Style, init

örnek demoCities.json
with open('data/23.10.2024/demoCities.json', 'r') as file:
    cities_data = json.load(file)
[
{
"url": "https://nomads.com/minot",
"short_slug": "minot",
"general": {
"name": "Minot, ND",
"long_slug": "minot-nd-united-states",
"continent": "North America",
"country": "United States",
"latitude": 48.2325,
"longitude": -101.2963,
"similar_cities": [
{
"name": "Las Vegas, NV",
"country": "United States",
"country_slug": "united-states",
"short_slug": "las-vegas",
"distance_time": 120,
"vehicle_type": "plane"
},
{
"name": "San Antonio, TX",
"country": "United States",
"country_slug": "united-states",
"short_slug": "san-antonio",
"distance_time": 180,
"vehicle_type": "plane"
},
{
"name": "Los Angeles, CA",
"country": "United States",
"country_slug": "united-states",
"short_slug": "los-angeles",
"distance_time": 180,
"vehicle_type": "plane"
},
{
"name": "New York City, NY",
"country": "United States",
"country_slug": "united-states",
"short_slug": "new-york-city",
"distance_time": 180,
"vehicle_type": "plane"
},
{
"name": "Orlando, FL",
"country": "United States",
"country_slug": "united-states",
"short_slug": "orlando",
"distance_time": 240,
"vehicle_type": "plane"
},
{
"name": "Miami, FL",
"country": "United States",
"country_slug": "united-states",
"short_slug": "miami",
"distance_time": 240,
"vehicle_type": "plane"
},
{
"name": "Cancun",
"country": "Mexico",
"country_slug": "mexico",
"short_slug": "cancun",
"distance_time": 240,
"vehicle_type": "plane"
},
{
"name": "Bogota",
"country": "Colombia",
"country_slug": "colombia",
"short_slug": "bogota",
"distance_time": 420,
"vehicle_type": "plane"
},
{
"name": "Cairo",
"country": "Egypt",
"country_slug": "egypt",
"short_slug": "cairo",
"distance_time": 780,
"vehicle_type": "plane"
},
{
"name": "Dubai",
"country": "United Arab Emirates",
"country_slug": "united-arab-emirates",
"short_slug": "dubai",
"distance_time": 900,
"vehicle_type": "plane"
}
],
"near_cities": [
{
"name": "Bismarck, ND",
"country": "United States",
"country_slug": "united-states",
"short_slug": "bismarck",
"distance_time": 21,
"vehicle_type": "plane"
},
{
"name": "Regina",
"country": "Canada",
"country_slug": "canada",
"short_slug": "regina",
"distance_time": 28,
"vehicle_type": "plane"
},
{
"name": "Grand Forks, ND",
"country": "United States",
"country_slug": "united-states",
"short_slug": "grand-forks",
"distance_time": 28,
"vehicle_type": "plane"
},
{
"name": "Winnipeg",
"country": "Canada",
"country_slug": "canada",
"short_slug": "winnipeg",
"distance_time": 28,
"vehicle_type": "plane"
},
{
"name": "Fargo, ND",
"country": "United States",
"country_slug": "united-states",
"short_slug": "fargo",
"distance_time": 30,
"vehicle_type": "plane"
},
{
"name": "Rapid City, SD",
"country": "United States",
"country_slug": "united-states",
"short_slug": "rapid-city",
"distance_time": 39,
"vehicle_type": "plane"
},
{
"name": "Saskatoon",
"country": "Canada",
"country_slug": "canada",
"short_slug": "saskatoon",
"distance_time": 46,
"vehicle_type": "plane"
},
{
"name": "Billings, MT",
"country": "United States",
"country_slug": "united-states",
"short_slug": "billings",
"distance_time": 50,
"vehicle_type": "plane"
},
{
"name": "St. Cloud, MN",
"country": "United States",
"country_slug": "united-states",
"short_slug": "st-cloud",
"distance_time": 53,
"vehicle_type": "plane"
},
{
"name": "Minneapolis, MN",
"country": "United States",
"country_slug": "united-states",
"short_slug": "minneapolis",
"distance_time": 57,
"vehicle_type": "plane"
},
{
"name": "Sioux Falls, SD",
"country": "United States",
"country_slug": "united-states",
"short_slug": "sioux-falls",
"distance_time": 57,
"vehicle_type": "plane"
},
{
"name": "Casper, WY",
"country": "United States",
"country_slug": "united-states",
"short_slug": "casper",
"distance_time": 57,
"vehicle_type": "plane"
}
],
"pros": [
"Pretty safe",
"Fast internet",
"Perfect humidity now",
"Good air quality on average",
"Spacious and not crowded",
"Very easy to do business",
"High quality of education",
"Great hospitals",
"Roads are very safe",
"Great freedom of speech",
"Democratic",
"Everyone speaks English",
"Very safe for women",
"Family friendly",
"Very friendly to LGBTQ+",
"Not many people smoke tobacco",
"(Medical) marijuana MAY be legal, unenforced or decriminalized (always double check this)"
],
"cons": [
"Very expensive",
"Not much to do",
"Gets very cold in the winter",
"Difficult to make friends",
"High alcohol consumption"
]
},
"scores": {
"nightlife": 3.0,
"working_places": null,
"family_friendly": 3.5659197347,
"safety": 4,
"quality_of_life": 3.4022399375,
"education": 4.3888888889,
"wifi": 4.0,
"fun": 3.0,
"walking_available": 5.0,
"healthcare": 4.3790746144,
"lack_of_racism": 4.5,
"english_speaking": 5.0,
"traffic_safety": 3.0,
"foreigners_friendly": null,
"female_friendly": 4.0,
"lgbtq_friendly": 5.0,
"startup_score": 2.9846505973
},
"guides": {
"average_trip_length": null,
"internet_speed_avg": 35.0,
"air_quality_avg": 18,
"power": {
"plug_types": ["American-type A-plug"],
"voltage": "115V",
"frequency": "60Hz"
},
"suggested_atm_take_out": null,
"tipping": { "value": 1, "description": "15% tipping" },
"cashless": { "value": 1, "description": "Cards OK almost everywhere" },
"tap_water": 1,
"return_rate": null,
"visitors_per_year": null,
"tourists_now": null,
"population": 46000,
"gdp_per_capita": 57808,
"density": null,
"religious_government": 0,
"male_percent": null,
"female_percent": null,
"apartment_listings": {
"name": "Craigslist",
"url": "http://craigslist.org",
"logo": "https://logo.clearbit.com/craigslist.org"
},
"best_short_haul_air_carrier": null,
"best_intl_air_carrier": {
"name": "Delta",
"url": "http://www.delta.com/",
"logo": "https://logo.clearbit.com/www.delta.com/"
},
"best_taxi_app": {
"name": "Uber",
"url": "http://uber.com",
"logo": null
},
"best_hospital": {
"name": "Trinity Health Minot",
"url": "http://www.trinityhealth.org/",
"logo": "https://logo.clearbit.com/www.trinityhealth.org/"
},
"online_electronics_shop": {
"name": "Amazon",
"url": "https://amazon.com",
"logo": "https://logo.clearbit.com/amazon.com"
}
},
"costs": {
"nomad_cost": 3439.35,
"expat_cost": 2109.53,
"family_cost": 5396.35,
"local_cost": 1541.81,
"hotel_price_median": 1964.2,
"airbnb_median": 1244.76,
"apartment_1bedroom": 1086.0,
"coworking_hot_desk": 235.0,
"water": null,
"banana": null,
"meat": null,
"chicken_breast": null,
"potato": null,
"dinner": 16.0,
"coca_cola": 2.0,
"beer_in_cafe": 5.0,
"international_school": 4000.0,
"mobile_data": 4.0,
"taxi_1km": 4.0
}
}

]