I’m working on my Capstone project for the IBM Data Science Professional Certificate Specialization on Coursera and wanted a fast and easy way to get venues around some coordinates. The way the explained in the course is fine, but I would like to have the data into a dataframe ready to use.
I found https://pypi.python.org/pypi/foursquare/() which works really good, but still had to clean the result, thus this.
I developed a small package called foursquare_api_tools that returns the venues in a dataframe with several columns. You can check the package in GitHub
You can use it in Jupyther Notebooks without problems. I tested it in IBM Cloud and https://labs.cognitiveclass.ai
Just install it using
[code language=”python”]!pip install foursquare
Example of use
[code language=”python”]import foursquare as fs
from foursquare_api_tools import foursquare_api_tools as ft
Initialize the client
[code language=”python”]CLIENT_ID = ‘YOUR_CLIENT_ID’ # your Foursquare ID
CLIENT_SECRET = ‘YOUR_SECRET’ # your Foursquare Secret
VERSION = ‘20180605’ # Foursquare API version
this example uses Userless Auth
[code language=”python”]# Construct the client object using foursquare package
client = fs.Foursquare(client_id=CLIENT_ID, client_secret=CLIENT_SECRET, version=VERSION)
Use the function
[code language=”python”]venues_explore(client,lat=’40.7233′,lng=’-74.0030′,limit=100, offset=2)
Here is an example notebook created on dataplatform.cloud.ibm.com
This is the first version and I’m using it for the project, but it can still have some bugs.
I’ll add more information and details in the future. In the meanwhile you are welcome to check the code on GitHub.