Delving into Delusion

Hoes” in Ludacris’ Area Codes

 November 14, 2014      Stardate: 68335.6     Tagged as: Python Matplotlib

In [1]:
from IPython.display import Image

Ludacris is a rapper with success in the early 2000’s who went on to become an actor. His most famous role is probably in The Fast and the Furious movies. Anyways, he’s got this song named Area Codes where he raps about all the area codes in which he’s got “hoes”. I’ve seen an old version of a map where all the area codes he mentions are mapped. It’s from 2008 and the link from claims that the source is from a non-operational blog called

I haven’t worked very much with maps or shapefiles so I thought it would be fun to recreate this map in Python. It was a good experience and I wanted to share it.

In [2]:
# import libraries
from bs4 import BeautifulSoup
import requests
import re

import warnings

%load_ext version_information

First I scrape the lyrics from the song page at

In [3]:
# this is the url for the page 
artist_url = ""

# Scrap rap genius lyrics page
response = requests.get(artist_url, headers={'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko'})
soup = BeautifulSoup(response.text, "html.parser")
lyrics = soup.find('div', class_='lyrics').text.strip()

Let’s check that is worked. The lyrics should be in a long string.

In [4]:
[Chorus: Nate Dogg]
I’ve got hoes, I’ve got hoes
In different area codes (Area), area codes (Codes)
Hoes! Hoes, hoes, in different area codes (Area)
Area codes (Codes)

[Verse 1 - Ludacris]
Now you thought I was just 7-7-0, and 4-0-4?
I'm worldwide, bitch act like y'all don't know
It's the abominable ho man
Globe-trot international post man
Neighbor-dick dope man
7-1-8's, 2-0-2's
I send small cities and states I-O-U's
9-0-1, matter of fact 3-0-5
I'll jump off the G4, we can meet outside
So control your hormones and keep your drawers on
'Til I close the door and I'm jumping your bones
3-1-2's, 3-1-3's (oh)
2-1-5's, 8-0-tree's (oh)
Read your horoscope and eat some hors d'oeuvres
10 on pump one; these hoes is self serve
7-5-7, 4-1-0's, my cell phone just overloads

[Chorus: Nate Dogg]
I’ve got hoes, I’ve got hoes
In different area codes (Area), area codes (Codes)
Hoes! Hoes, hoes, in different area codes (Area)
Area codes (Codes)
I’ve got hoes!

[Verse 2 - Ludacris]
Now every day is a ho-ly day, so stop the violence and put the 4-4 away
Skeet, shoot a ho today
5-0-4, 9-7-2's
7-1-tree, whatcha gon' do?
You checking out the scene, I'm checking a ho tonight
With perpendicular, vehicular ho-micide
3-1-4, 2-0-1 (hey)
Too much green, too much fun (hey)
I bang cock in Bangkok
Can't stop, I turn and hit the same spot, think not
I'm the Thrilla in Manila, schlong in Hong Kong
Pimp 'em like Bishop, Magic, Don Juan
Man after Henny with a coke and a smile
I just pick up the motherfuckin' phone and dial
I got my condoms in a big ass sack
I'm slanging this dick like a New Jack

[Verse 3: Nate Dogg]
Is it cause they like my gangsta walk?
Is it cause they like my gangsta talk?
Is it cause they like my handsome face?
Is it cause they like my gangsta ways?
Whatever it is, they love it and they just won't let me be
I handles my biz, don't rush me, just relax and let me be free
Whenever I call (I call), come running
2-1-2 or 2-1-3
You know that I ball (I ball), stop fronting
Or I'll call my substitute freak (hoes)

[Chorus: Nate Dogg]
I’ve got hoes, I’ve got hoes
In different area codes (Area), area codes (Codes)
Hoes! Hoes, hoes, In different area codes (Area)
Area codes (Codes)
I’ve got hoes!

[Outro - Ludacris]
9-1-6, 4-1-5, 7-0-4
Shout out to the 2-0-6
Everybody in the 8-0-8
Ha-ah, 2-1-6, 7-0-2, 4-1-4
3-1-7, 2-1-4's and the 2-8-1's
3-3-4, 2-0-5, I see ya
Uh-uh, 3-1-8, 6-0-1's, 2-0-tree
8-0-4, 4-0-2, 3-0-1
9-0-4, 4-0-7, 8-5-0
7-0-8, 5-0-2
Hoes in different area codes, know that
Southern Hoes-pitality, Northern Exhoes-ure
Ha-ha, ho ridin' on the West coast
Ya understand what I'm saying?
Ho-cus pocus, you the dopest
Hoes to the right, hoes to the left, 5 hoes this time
Whoo! Ho no!
The Hip-hop ho-ller-coaster, that's what we on right now
Ha-ha, no need to get all ho-stile
Def Jam South baby, Disturbing Tha Peace
Jazze Pheezy, Uncle Face
Ludacris, uh, hoes...[whistling] I'm sweating like a motherf

Success! Now, let’s scrape out all the area codes. If you look, they are in a format #-#-#. We can use a regular expressiong to search for this pattern.

By the way, regular expressions are a blank magic. I use an online site to build and verify the expression.

In [5]:
pattern = r"[0-9]-[0-9]-[0-9]"  
areacodes = re.compile(pattern).findall(lyrics)  

Let’s check again.

In [6]:

Good, now we have all the area codes pulled out but it’s in a goofy format. Let’s pull out the hyphens.

In [7]:
codes = []
for code in areacodes: codes.append(code.replace("-", ""))

And check it…

In [8]:
['770', '404', '718', '202', '901', '305', '312', '313', '215', '757']

Import libraries for plotting the map

In [10]:
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
from matplotlib.patches import Polygon

%matplotlib inline
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-10-48decfd24a7d> in <module>
      1 import matplotlib.pyplot as plt
----> 2 from mpl_toolkits.basemap import Basemap
      3 from matplotlib.patches import Polygon
      5 get_ipython().run_line_magic('matplotlib', 'inline')

ModuleNotFoundError: No module named 'mpl_toolkits.basemap'

I downloaded shapefiles for all the area codes at USGS. It looked good but it had some Canadian boundaries that I was not interested in. I loaded the shapefile into and filtered out the Canadian boundaries. I’m still left with the Hawaii, Alaska, and Puerto Rico but I can window those out if I needed.

In [10]:

Now that I have a good shapefile let’s map it out.

In [11]:
# instantiate a figure

# create the map
map = Basemap(llcrnrlon=-119,llcrnrlat=22,urcrnrlon=-64,urcrnrlat=49,

# load the shapefile I created
map.readshapefile('./USAreaCode/AreaCode', name='areacodes', drawbounds=True)

# collect the area codes from the shapefile attributes so we can look up the shape obect for an area code by it's 3-digit number
area_codes = []
for shape_dict in map.areacodes_info:
ax = plt.gca() # get current axes instance

# loop through the song area codes previously parsed and cleaned
for code in codes:
    seg = map.areacodes[area_codes.index(code)]
    poly = Polygon(seg, facecolor='red',edgecolor='red')

plt.title('Area Codes that Ludacris has \'Hoes\'', fontsize=16)

There you go, a plot of where Ludacris got hoes. I did not include the 808 area code from Hawaii because it throws the view way off and the Hawaiian plot is so small you don’t even see it.

System & Library Info

In [12]:
%version_information bs4, requests, matplotlib, basemap
Python3.5.0 32bit [MSC v.1900 32 bit (Intel)]
OSWindows 7 6.1.7601 SP1
Sat Nov 14 23:21:02 2015 Pacific Standard Time