I’ve been a happy Chase customer since 2010. I’ve appreciated the investment in their mobile platform and was excited about the recent You Invest announcement, allowing customers to trade 100 stocks and ETFs a year for free. With 5,100+ branches and 16,000 ATMs+ nationwide, Chase has a strong national footprint.
In this post, I use Python to recreate the map below for my home state of Utah, scrapping branch and ATM information from Chase.com and obtaining geographic coordinates using the Google Maps geocoding API.
Scrapping Branch & ATM Information with Selenium
As usual, we’ll begin by calling the necessary libraries.
Next, we need to pass the driver a URL. Here I’ve used the Utah URL. This could easily be adapted to other states by changing the last two letters of the link.
Also note the executable path, which is pointed to the directory where my ChromeDriver is located. You can download the driver here.
When this code finishes running, the “locations” list contains location names, such as the following Utah cities:
We then convert these locations into Chase.com URLs.
The links now look like this:
The function below represents the process of scrapping the data for each location.
We’ll apply the function to each location URL to extract the corresponding branch and ATM information.
Finally, we’ll clean the information we’ve scrapped and organize it into tidy columns.
Here a sample of what the final dataset looks like:
|Bountiful||510 S 200 W Bountiful, UT 84010||Branch|
|Farmington Station Park||100 N Station Pkwy Farmington, UT 84025||Branch|
|Brigham Young University||800 E Campus Dr Provo, UT 84602||ATM|
|Fashion Place||6255 S State St Murray, UT 84107||Branch|
Geocoding Branch Address via Google Maps API
Per Google’s Get Started article, geocoding is the process of converting addresses into geographic coordinates, like latitude and longitude. Once we have a longitude and latitude combination, we can plot the branch and ATM locations on a map using Tableau or R.
Here is the Python code used to accomplish the geocoding:
Please note that you’d need to insert your own Google Cloud API key to make the code run. Finally, let’s visualize some of the data points with R!
Here’s the code to create this visualization: