The Geography of Mexican Restaurants

My dad’s coworker told him that the city with the most Mexican restaurants is Chicago, a statement that didn’t sound right to either of us. There’s nothing better than proving somebody wrong, so I set out to investigate the matter for myself.

I found where (I think) his coworker got that fact: a report put out by Datafiniti, a data aggregator. I’m not sure how or where Datafiniti gets their data, but it doesn’t seem very complete–for example, I’d be shocked if there’s only 207 Mexican restaurants in all of Los Angeles.

To tackle this, I decided to use the Yelp API. Yelp is widely used, has a decently generous daily call limit, allows for research/analytical usage, and I have personally found it to be more accurate than the Google Places API, which sometimes returns junky results that don’t meet my search criteria. The big caveat, of course, is that Yelp will only return restaurants that have been reviewed. This does skew the results towards areas with review-happy residents and/or established restaurants, but I’m okay with this risk.

My search algorithm worked as follows:

  1. Search for Mexican restaurants in each county in the US
  2. Yelp’s API returns a maximum of 1000 results. Larger counties will hit this limit, so we need to do a finer-grained search there. At an estimated average density of 100 Mexican restaurants per 100k residents, we’ll need to re-search counties with >1m residents. I re-did the search for every ZIP code in those counties.

To get started, you’ll need the following:

  1. A Yelp API key
  2. A list of all counties in the US, with rough population numbers
  3. A list of ZIP codes by county
  4. County shapefiles

I’ve posted the code on Github; I had wanted to include it here but unfortunately WordPress insists on horribly mangling it.

 

The Results

It took several days to collect all the data due to the daily API limit. However, I came back with what I believe is the entire set of Mexican restaurants on Yelp: over 89,000 entries! This far exceeds the 19,000 restaurants Datafiniti said they analyzed.

First things first: at least on Yelp, Chicago does not have the most Mexican restaurants.

Note: these are determined by the address on Yelp, not the restaurant’s lat/long. If the restaurant does not have an address on Yelp, it does not appear in these results.

MostMex

Even when filtering out chains (of which I found 100+, defined as restaurants with at least 10 locations), Chicago is only #3:

MostMex_nochain

And when looking at it per capita, Chicago doesn’t even figure.

MostMex_percapita

Take that, Datafiniti! (in good spirit, of course, I bear no grudge)

Just for fun, we can see that the number of Mexican restaurants has a lot do to with the demographics of an area:

bymexpop

Results, Mapped

Of course, I can’t keep my grubby paws away from a chance to map something. Using the same techniques I posted about here,  I made a few maps exploring the geography of Mexican restaurants.

percapita_final

chains_final

Most Popular Chains

Finally, I love Nathan Yau’s gridded dot maps and wanted to make my own. The geography of Mexican chains fits this perfectly.

If you’re interested how I did it, the code is on Github. In essence, I just coerced the lat/long of each chain to a 0.25 degree grid, then checked which chain was the most common at each grid point.

griddeddots

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s