Using Yelp API to estimate number of businesses in a given city

734 views Asked by At

I'm currently experimenting with the Yelp API, using Python. I'm interested in estimating the number of businesses present in a city using the Yelp API.

Example

I tried doing this with San Francisco, as follows:

#create yelp_api using private keys 
search_results = yelp_api.search_query(location="San Francisco, California")
business_estimate = search_results['total'] #total is the total number of results obtained

My reasoning with the above was, in leaving the other fields blank my search would be as broad as possible, i.e. a search of all businesses in San Francisco.

However, between executions of the above script, business_estimate fluctuated in the thousands. e.g. 63000, 55000, 81000

Question

My question is, why does business_estimate fluctuate so much? Also, is there a better method than mine for estimating the number of businesses in a given city than my method?

For reference, here is the Yelp API documentation: http://www.yelp.ie/developers/documentation/v2/search_api

1

There are 1 answers

0
ROB On

If you are really interested in the number of businesses in some area, then it does not seem right to rely on Yelp, which I think focuses on consumer facing businesses and is not very complete. If you want to get the data for free: Have you considered using the Census instead? E.g.: http://www.census.gov/econ/cbp/overview.htm