import pandas as pdimport folium# Data from the imagedata = {"Company": ["Boeing Defense, Space & Security", "Lockheed Martin", "Roberson Tool", "Advanced Product Design & Mfg.","Advent Design", "Bihler of America, Inc", "ALKAB Contract Manufacturing, Inc.", "Plastic Supply of PA","L3Harris Technologies", "L3Harris Technologies", "Raytheon Technologies", "Northrop Grumman", "BAE Systems","BAE Systems", "BAE Systems", "Siemens Healthcare", "Siemens Robotics", "Siemens", "Siemens Healthcare","Johnson & Johnson", "Johnson & Johnson", "Johnson & Johnson", "Stryker Corporation", "Becton, Dickinson and Company (BD)","Covidian", "DePuy Synthes (Johnson & Johnson subsidiary)", "Smith & Nephew", "Integra LifeSciences"],"Location": ["Ridley Park, PA", "Moorestown, NJ", "New Jersey", "Coatesville, PA", "Bristol, PA", "Phillipsburg, NJ","New Kensington, PA", "Royersford, PA", "Clifton, New Jersey", "Philidpelhia, PA", "Tlton Falls, New Jersey","Bethpage, NY", "Mt Laural, NJ", "Wayne, NJ", "Greenlawn, NY", "Flanders, NJ", "Iselin, NJ", "Princeton, NJ","Malven, PA", "Litiz", "Malvern, PA", "Washington, PA", "Mahwah, New Jersey", "Western PA", "Jersey City, NJ","West Chester, Pennsylvania", "Washington, Pennsylvania", "Princton, New Jersey"]}# Create a DataFramedf = pd.DataFrame(data)# Function to get latitude and longitudedef get_lat_long(location):from geopy.geocoders import Nominatimgeolocator = Nominatim(user_agent="geoapiExercises")try:loc = geolocator.geocode(location)if loc:return loc.latitude, loc.longitudeelse:return None, Noneexcept:return None, None# Add latitude and longitude columnsdf["Latitude"] = df["Location"].apply(lambda x: get_lat_long(x)[0])df["Longitude"] = df["Location"].apply(lambda x: get_lat_long(x)[1])# Filter out rows where latitude or longitude could not be obtaineddf = df.dropna(subset=["Latitude", "Longitude"])# Create a map centered in the USmap_usa = folium.Map(location=[39.8283, -98.5795], zoom_start=5)# Add each company location to the mapfor _, row in df.iterrows():folium.Marker(location=[row["Latitude"], row["Longitude"]],popup=row["Company"],tooltip=row["Company"]).add_to(map_usa)# Save the map to a filemap_file = "/mnt/data/target_companies_map.html"map_usa.save(map_file)map_file