<jupyter_start><jupyter_text>Week-3 IBM DS Professional Assignment-Part2 Assignment Details & Submission Guidelines Now that you have built a dataframe of the postal code of each neighborhood along with the borough name and neighborhood name, in order to utilize the Foursquare location data, we need to get the latitude and the longitude coordinates of each neighborhood.In an older version of this course, we were leveraging the Google Maps Geocoding API to get the latitude and the longitude coordinates of each neighborhood. However, recently Google started charging for their API: http://geoawesomeness.com/developers-up-in-arms-over-google-maps-api-insane-price-hike/, so we will use the Geocoder Python package instead: https://geocoder.readthedocs.io/index.html.The problem with this Package is you have to be persistent sometimes in order to get the geographical coordinates of a given postal code. So you can make a call to get the latitude and longitude coordinates of a given postal code and the result would be None, and then make the call again and you would get the coordinates. So, in order to make sure that you get the coordinates for all of our neighborhoods, you can run a while loop for each postal code. Taking postal code M5G as an example, your code would look something like this: Due to problems with geocoder, Perfer to use following file: Given that this package can be very unreliable, in case you are not able to get the geographical coordinates of the neighborhoods using the Geocoder package, here is a link to a csv file that has the geographical coordinates of each postal code: http://cocl.us/Geospatial_data<jupyter_code>#Importing Dependencies
import numpy as np # library to handle data in a vectorized manner

import pandas as pd # library for data analsysis
print("***********Libraries Imported*********")
#Getting Geospatial_data and creating data frame using pandas
url='http://cocl.us/Geospatial_data'
ll_df=pd.read_csv(url)
ll_df.head()
ll_df.shape
toronto_csv = "./df_toronto_postcodes.csv" #CSV File saved from Part1 https://github.com/shasaankdave/Coursera_Capstone/blob/master/Week3%20IBM%20DS%20Coursera%20Capstone_Segmentaion_Clustering_Neighbourhood_Toronto_Part1.ipynb
postcode_df = pd.read_csv(toronto_csv,index_col=0)
postcode_df.head()
#Discrepancies between field names in ll_df & postcode_df, key = PostCode
#Rename field

ll_df.rename(columns={"Postal Code": "PostalCode"}, inplace=True)
ll_df.head()
#Check Postcode dataframe before merging
postcode_df.head()
#Merge longitude latitude datafram & Postal Code dataframe on key "PostalCode"
toronto_df = postcode_df.merge(ll_df, on="PostalCode", how="left")
toronto_df.head()

toronto_df.to_csv(r'df_toronto_details.csv')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.0681653372008702, 'fraction_numerical': 0.005438723712835388, 'mean_word_length': 5.795566502463054, 'pattern_counts': {'":': 1, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '218437', 'license': 'CC-BY-3.0', 'n_tokens_mistral': 811, 'n_tokens_neox': 766, 'n_words': 333, 'path': 'Week3 IBM DS Coursera Capstone_Segmentaion_Clustering_Neighbourhood_Toronto_Part2.ipynb', 'repo_name': 'shasaankdave/Coursera_Capstone', 'size': '2758'}