Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
zipcode_lat_dict.py
# Create df with zip code as index and mean latitude value for each zip code
no_index_zip_lat = df.groupby('zipcode', as_index=True)['lat'].mean()
# Convert the data frame to a dict, the zip is the key and mean latitude is the value
zip_lat_dict = no_index_zip_lat.to_dict()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment