I have a dataframe that contains county and state information (ie: Bucks, PA). I am trying to validate that my dataframe is correct and if not (as it often isn't spelled correctly), fix the mistakes. I have a separate list that contains all county and state information for the USA to use for against my dataframe for the validation.
This is what I have accomplished so far:
df_CountyState_List= ['Floyd, IA', 'Franklin, IA', 'Fremont, IA', 'Greene, IA' ]
df_results = ['Franklin, IA', 'Freemont, IA', 'Green, IA']
desired df_results=[ 'Franklin, IA', 'Fremont, IA', 'Greene, IA' ]
for updatelocation in df_CountyState_List['Location'].to_list():
df_results.loc[ df_results['Location'].str.contains(updatelocation), 'Location' ] ==updatelocation