I have a main dataframe with county names. I have another data frame with county names and their latitude. I want to create a new latitude column in the main df for matching county names. The main df has some not matching names.
Main code:
df =
County
0 Maricopa
1 Hillsborough
2 Henry
3 Ogle
4 Mitchell
5 Melbourne
url='https://public.opendatasoft.com/explore/dataset/us-zip-code-latitude-and-longitude/download/?format=csv&timezone=America/New_York&lang=en&use_labels_for_header=true&csv_separator=%3B'
uszip=pd.read_csv(url,sep=";")
df['Latitude'] = df['County'].map(dict(uszip[['City','Latitude']]))
df =
County Latitude
0 Maricopa NaN
1 Hillsborough NaN
2 Henry NaN
3 Ogle NaN
4 Mitchell NaN
5 Melbourne NaN