Identify profitable advertising locations using Washington DC Metro data
By: Tanmayee W
Tags: Data Analytics, Pandas, Python, In Depth Analysis, Data Science

Identify profitable advertising locations using Washington DC Metro data

A simple analysis using rider footfall data in Python

Courtesy: DAVID TRAN/SHUTTERSTOCK

Living in Washington DC for the past 1 year, I have come to realize how WMATA metro is the lifeline of this vibrant city. The metro network is enormous and well-connected throughout the DMV area. When I first moved to the Capital city with no car, I often used to hop on the metro to get around. I have always loved train journeys and therefore unsurprisingly, metro became my most favorite way to explore this beautiful city. On my travels, I often notice the product placements and advertisements on metro platforms, near escalators/elevators, inside the metro trains, etc. A good analysis of the metro rider data would help the advertisers to identify which metro stops are the busiest at what times so as to increase the ad exposure. I chanced upon this free dataset and decided to plunge deep into it. In this article, I’ll walk you through my analysis.

Step 1: Importing necessary libraries

import pandas as pd

import numpy as np

import seaborn as sns

import matplotlib.pyplot as plt

import warnings

warnings.filterwarnings("ignore")

Step 2: Reading the data

Let us call our pandas dataframe as ‘df_metro’ which will contain the original data.

df_metro = pd.read_csv("DC MetroData.csv"

Step 3: Eyeballing the data and length of the dataframe

df_metro.head()

df_metro.columns

len(df_metro)

Step 4: Checking distinct values under different columns

Let us check what are the unique values in the column ‘Time’

df_metro['Time'].value_counts().sort_values()

Unique values in the column ‘Day’ are as follows:

df_metro['Day'].value_counts().sort_values()

Next step is to analyze few questions.

Q1. What are the popular entrances and exits?

The distinct count of records for each metro stop arranged in descending order will give us which are popular entrances and exits.

df_metro['Entrance'].value_counts().sort_values(ascending=False).head()

df_metro['Exit'].value_counts().sort_values(ascending=False).head()

Popular locations seem to be

Gallery Place-Chinatown: Major attractions are Capital One Arena (drawing big crowds for sporting events and music concerts), restaurants, bars, etc. Foggy Bottom: Government offices in the area makes it a popular commute destination Pentagon City: Its location just 2 miles away from the National Mall in downtown Washington makes the area a popular site for hotels and businesses. Dupont Circle: International Embassies located in the area Union Station: An important location for the long-distance travelers Metro center: A popular downtown location Fort Totten: Its Metro station serves as a popular transfer point for the Green, Yellow and Red lines

Takeaway: Advertisers should target the above popular metro stations that have the high rider footfall to grab maximum buyer attention.

Q2. What does the ridership look like during different days/times of the week?

This can be answered by simply plotting the riders’ data across different days and times. We will make use of the seaborn library to create this viz.

sns.set_style("whitegrid")

ax = sns.barplot(x="Day", y="Riders", hue="Time",

data = df_metro,

palette = "inferno_r")

ax.set(xlabel='Day', ylabel='# Riders')

plt.title("Rider Footfall on different Days/Times")

plt.show(ax)

Takeaway: Metro is a popular choice of work commute in the city and therefore, as expected the rider footfall is the highest during the Weekday, particularly more so during AM Peak and PM Peak. Companies planning to roll out new products should target these slots to attract attention and generate interest in the consumers. For advertising opportunities during the weekend, the most attractive time slot seems to be Midday, closely followed by PM Peak.

Q3. What are the busy routes during a typical weekday?

To analyze this question, we are going to consider a footfall of more than 500 riders at any given metro station. First, we will create a dataframe ‘busy_routes’ that contain data about routes with >500 riders. Second, we will filter this dataframe to contain data for only ‘AM Peak’. Third, we will sort this filtered output.

busy_routes = weekday[weekday['Riders']>500][['Merge', 'Time', 'Riders']]

peak_am = busy_routes.query('Time=="AM Peak"')

peak_am.sort_values('Riders').tail()

Repeating the same steps for ‘PM Peak’.

peak_pm = busy_routes.query('Time=="PM Peak"')

len(peak_pm)

peak_pm.sort_values('Riders').tail()

Takeaway: We see that the routes with high footfall during AM Peak are the same with high footfall during the PM Peak such as West Falls Church — Farragut West, Vienna-Farragut West, Shady Grove — Farragut North. This tells us that these are the popular work commute routes as people going to work in Farragut during AM peak return to their homes in Vienna/Falls Church/Shady Grove during PM peak. Advertisers should target these high traffic commute routes to maximize on their advertisements and product placements.

Q4. What are the popular metro routes during the weekends?

Let us perform a similar analysis as we did for the weekday. Since we are dealing with the weekend data here, we will consider metro stations with a footfall of more than 200 riders.

saturday = df_metro[df_metro['Day']=='Saturday']

busy_routes_sat = saturday[saturday['Riders']>200][['Merge', 'Time', 'Riders']]

busy_routes_sat.sort_values('Riders').tail()

sunday = df_metro[df_metro['Day']=='Sunday']

busy_routes_sun = sunday[sunday['Riders']>200][['Merge', 'Time', 'Riders']]

busy_routes_sun.sort_values('Riders').tail()

Takeaway: Smithsonian is an extremely popular destination with tourists as well as city-dwellers alike because of several museums and proximity to White House, The Capitol, national monuments, war memorials, etc. Our analysis tells us that the crowds head out from Crystal City, Pentagon City, Vienna, Franconia to the Smithsonian during the Midday, and return in the PM Peak. Most of these crowds are young families with kids which are an ideal audience for companies launching products meant for younger populations including children.

Q5. As an advertiser, which locations should I target during Late Night?

We will do a similar analysis as above to identify which metro stations are ideal for putting out advertisements late in the night. For the ‘Late Night’, we will consider metro stations with a footfall of >50 riders.

late_night = df_metro[df_metro['Day']=='Late Night']

busy_routes_latenight = late_night[late_night['Riders']>50][['Merge', 'Time', 'Riders']]

busy_routes_latenight.sort_values('Riders').tail()

Takeaway: We see that late night the riders ride the metro from popular locations such as Gallery Place, Clarendon, Dupont Circle and U Street with a buzzing nightlife. Therefore, advertisers wanting to appeal to this section of the population (which normally would be a younger population) should potentially target these metro stations to grab maximum attention.

Closing remarks: This dataset was fairly straightforward and hence, we did not spend a lot of time cleaning and wrangling the data. With the given data, we were able to find sweet spots that would ensure maximum moolah for advertisers’ money. Thanks for reading!