Important: I do not use this anymore and is not being maintained. This post is here just as reference.
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 fantastic,
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 Jupyter Notebooks without problems. I tested it in IBM
Cloud and
https://labs.cognitiveclass.ai
Just install it using !pip install foursquare
Example of use
Import libraries
import foursquare as fs from foursquare_api_tools
import foursquare_api_tools as ft
Initialize the client
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
# Construct the client object using foursquare package
client = fs . Foursquare ( client_id = CLIENT_ID , client_secret = CLIENT_SECRET ,
version = VERSION )
Use the function
venues_explore ( client , lat = '40.7233' , lng = '-74.0030' , limit = 100 ,
offset = 2 )
Example
Here is an example notebook created on dataplatform.cloud.ibm.com
{
"nbformat_minor": 1,
"cells": [
{
"execution_count": 9,
"cell_type": "code",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": "Requirement not upgraded as not directly required: foursquare in /opt/conda/envs/DSX-Python35/lib/python3.5/site-packages\nRequirement not upgraded as not directly required: requests>=2.1 in /opt/conda/envs/DSX-Python35/lib/python3.5/site-packages (from foursquare)\nRequirement not upgraded as not directly required: six in /opt/conda/envs/DSX-Python35/lib/python3.5/site-packages (from foursquare)\nRequirement not upgraded as not directly required: chardet<3.1.0,>=3.0.2 in /opt/conda/envs/DSX-Python35/lib/python3.5/site-packages (from requests>=2.1->foursquare)\nRequirement not upgraded as not directly required: idna<2.7,>=2.5 in /opt/conda/envs/DSX-Python35/lib/python3.5/site-packages (from requests>=2.1->foursquare)\nRequirement not upgraded as not directly required: urllib3<1.23,>=1.21.1 in /opt/conda/envs/DSX-Python35/lib/python3.5/site-packages (from requests>=2.1->foursquare)\nRequirement not upgraded as not directly required: certifi>=2017.4.17 in /opt/conda/envs/DSX-Python35/lib/python3.5/site-packages (from requests>=2.1->foursquare)\nCollecting foursquare_api_tools from git+https://github.com/dacog/foursquare_api_tools.git#egg=foursquare_api_tools\n Cloning https://github.com/dacog/foursquare_api_tools.git to /home/dsxuser/.tmp/pip-build-ehhz4mgs/foursquare-api-tools\nRequirement not upgraded as not directly required: pandas in /opt/conda/envs/DSX-Python35/lib/python3.5/site-packages (from foursquare_api_tools)\nRequirement not upgraded as not directly required: foursquare in /opt/conda/envs/DSX-Python35/lib/python3.5/site-packages (from foursquare_api_tools)\nRequirement not upgraded as not directly required: python-dateutil>=2 in /opt/conda/envs/DSX-Python35/lib/python3.5/site-packages (from pandas->foursquare_api_tools)\nRequirement not upgraded as not directly required: pytz>=2011k in /opt/conda/envs/DSX-Python35/lib/python3.5/site-packages (from pandas->foursquare_api_tools)\nRequirement not upgraded as not directly required: numpy>=1.9.0 in /opt/conda/envs/DSX-Python35/lib/python3.5/site-packages (from pandas->foursquare_api_tools)\nRequirement not upgraded as not directly required: requests>=2.1 in /opt/conda/envs/DSX-Python35/lib/python3.5/site-packages (from foursquare->foursquare_api_tools)\nRequirement not upgraded as not directly required: six in /opt/conda/envs/DSX-Python35/lib/python3.5/site-packages (from foursquare->foursquare_api_tools)\nRequirement not upgraded as not directly required: chardet<3.1.0,>=3.0.2 in /opt/conda/envs/DSX-Python35/lib/python3.5/site-packages (from requests>=2.1->foursquare->foursquare_api_tools)\nRequirement not upgraded as not directly required: idna<2.7,>=2.5 in /opt/conda/envs/DSX-Python35/lib/python3.5/site-packages (from requests>=2.1->foursquare->foursquare_api_tools)\nRequirement not upgraded as not directly required: urllib3<1.23,>=1.21.1 in /opt/conda/envs/DSX-Python35/lib/python3.5/site-packages (from requests>=2.1->foursquare->foursquare_api_tools)\nRequirement not upgraded as not directly required: certifi>=2017.4.17 in /opt/conda/envs/DSX-Python35/lib/python3.5/site-packages (from requests>=2.1->foursquare->foursquare_api_tools)\nInstalling collected packages: foursquare-api-tools\n Found existing installation: foursquare-api-tools 0.1\n Uninstalling foursquare-api-tools-0.1:\n Successfully uninstalled foursquare-api-tools-0.1\n Running setup.py install for foursquare-api-tools ... \u001b[?25ldone\n\u001b[?25hSuccessfully installed foursquare-api-tools-0.1\n"
}
],
"source": "!pip install foursquare\n!pip install git+https://github.com/dacog/foursquare_api_tools.git#egg=foursquare_api_tools --upgrade --force-reinstall\n\nimport foursquare as fs\n"
},
{
"execution_count": 11,
"cell_type": "code",
"metadata": {},
"outputs": [],
"source": "# The code was removed by Watson Studio for sharing."
},
{
"execution_count": 12,
"cell_type": "code",
"metadata": {},
"outputs": [],
"source": "# Construct the client object \nclient = fs.Foursquare(client_id=CLIENT_ID, client_secret=CLIENT_SECRET, version=VERSION)"
},
{
"execution_count": 13,
"cell_type": "code",
"metadata": {},
"outputs": [
{
"execution_count": 13,
"metadata": {},
"data": {
"text/html": "\n\n
\n \n \n \n index \n Address \n Category \n City \n Country \n Latitude \n Longitude \n Name \n Postal Code \n \n \n \n \n 0 \n 0 \n 459 Broome St \n Arts & Crafts Store \n New York \n United States \n 40.722326 \n -74.000994 \n Purl Soho \n 10013 \n \n \n 1 \n 0 \n 42 Wooster St \n Salon / Barbershop \n New York \n United States \n 40.722371 \n -74.002562 \n Sam Brocato Salon \n 10013 \n \n \n 2 \n 0 \n 466 Broome St \n Dance Studio \n New York \n United States \n 40.722578 \n -74.001363 \n Dance With Me SoHo \n 10013 \n \n \n 3 \n 0 \n 484 Broome St \n Dessert Shop \n New York \n United States \n 40.723101 \n -74.002477 \n MarieBelle \n 10013 \n \n \n 4 \n 0 \n 171 Spring St \n Tapas Restaurant \n New York \n United States \n 40.724800 \n -74.002220 \n Boqueria \n 10012 \n \n \n 5 \n 0 \n 71 Greene St \n Men's Store \n New York \n United States \n 40.723427 \n -74.000742 \n ONS Clothing \n 10012 \n \n \n 6 \n 0 \n 494 Broome St \n Supermarket \n New York \n United States \n 40.723192 \n -74.002775 \n Sunrise Mart \n 10013 \n \n \n 7 \n 0 \n 148 Spring St \n Shoe Store \n New York \n United States \n 40.724261 \n -74.001328 \n Dr. Martens \n 10012 \n \n \n 8 \n 0 \n 469 Broome St \n Women's Store \n New York \n United States \n 40.722630 \n -74.001511 \n Isabel Marant \n 10013 \n \n \n 9 \n 0 \n 35 Wooster St \n Art Museum \n New York \n United States \n 40.722393 \n -74.002730 \n The Drawing Center \n 10013 \n \n \n 10 \n 0 \n 453 Broome St \n Men's Store \n New York \n United States \n 40.722173 \n -74.001111 \n SuitSupply \n 10013 \n \n \n 11 \n 0 \n 398 W Broadway \n Dessert Shop \n New York \n United States \n 40.724523 \n -74.002748 \n Ladur\u00e9e \n 10012 \n \n \n 12 \n 0 \n 28-26 Wooster St \n Art Gallery \n New York \n United States \n 40.721780 \n -74.003170 \n Leslie+Lohman Museum of Gay & Lesbian Art \n 10013 \n \n \n 13 \n 0 \n 90 Thompson St \n Italian Restaurant \n New York \n United States \n 40.725223 \n -74.002594 \n San Carlo Osteria Piemonte \n 10012 \n \n \n 14 \n 0 \n 512 Broome St \n Bakery \n New York \n United States \n 40.723516 \n -74.003444 \n Pi Greek Bakerie \n 10013 \n \n \n 15 \n 0 \n 76 Greene St Fl 3 \n Design Studio \n New York \n United States \n 40.723466 \n -74.000606 \n The Line \u2013 New York \n 10012 \n \n \n 16 \n 0 \n 189 Spring St \n Bakery \n New York \n United States \n 40.725163 \n -74.002976 \n Dominique Ansel Bakery \n 10012 \n \n \n 17 \n 0 \n 529 Broome St \n Burger Joint \n New York \n United States \n 40.723897 \n -74.004221 \n Black Tap \n 10013 \n \n \n 18 \n 0 \n 470 Broome St \n Art Gallery \n New York \n United States \n 40.722607 \n -74.001432 \n Eden Fine Art \n 10013 \n \n \n 19 \n 0 \n 510 Broome St \n Italian Restaurant \n New York \n United States \n 40.723426 \n -74.003277 \n Aurora \n 10013 \n \n \n 20 \n 0 \n 93 Grand St \n Shoe Store \n New York \n United States \n 40.721534 \n -74.002109 \n The Vans DQM General \n 10013 \n \n \n 21 \n 0 \n 456 Broome St \n Boutique \n New York \n United States \n 40.722279 \n -74.000879 \n Henrik Vibskov \n 10013 \n \n \n 22 \n 0 \n 73 Thompson St \n Japanese Restaurant \n New York \n United States \n 40.724566 \n -74.002873 \n Hirohisa \n 10012 \n \n \n 23 \n 0 \n 149 Spring St \n Boutique \n New York \n United States \n 40.724372 \n -74.001496 \n LF Boutique \n 10012 \n \n \n 24 \n 0 \n 399 W Broadway \n Coffee Shop \n New York \n United States \n 40.724292 \n -74.002120 \n Ground Support \n 10012 \n \n \n 25 \n 0 \n 71 Sullivan St \n Falafel Restaurant \n New York \n United States \n 40.724523 \n -74.004088 \n Ba'al Cafe \n 10012 \n \n \n 26 \n 0 \n 139 Spring St \n Boutique \n New York \n United States \n 40.724289 \n -74.000843 \n CHANEL \n 10012 \n \n \n 27 \n 0 \n 33 Greene St \n Clothing Store \n New York \n United States \n 40.721688 \n -74.002298 \n Acne Studios \n 10013 \n \n \n 28 \n 0 \n 477 Broome St \n Women's Store \n New York \n United States \n 40.722684 \n -74.002160 \n Kirna Zab\u00eate \n 10013 \n \n \n 29 \n 0 \n 15 Thompson St. \n Cocktail Bar \n New York \n United States \n 40.722671 \n -74.004812 \n JIMMY at The James \n 10013 \n \n \n ... \n ... \n ... \n ... \n ... \n ... \n ... \n ... \n ... \n ... \n \n \n 70 \n 0 \n 15 Mercer St \n Clothing Store \n New York \n United States \n 40.720585 \n -74.002077 \n 3x1 \n 10013 \n \n \n 71 \n 0 \n 1 York St \n Gym \n New York \n United States \n 40.721128 \n -74.005398 \n Barry's Bootcamp TriBeCa \n 10013 \n \n \n 72 \n 0 \n Wooster St \n Mexican Restaurant \n New York \n United States \n 40.725482 \n -73.999950 \n Calexico Cart \n 10012 \n \n \n 73 \n 0 \n 160 Prince St \n Bakery \n New York \n United States \n 40.725968 \n -74.001254 \n Birdbath Neighborhood Green Bakery \n 10012 \n \n \n 74 \n 0 \n 486 Broadway \n Women's Store \n New York \n United States \n 40.721557 \n -73.999712 \n Madewell \n 10013 \n \n \n 75 \n 0 \n 451 Broadway \n Furniture / Home Store \n New York \n United States \n 40.720590 \n -74.001060 \n CB2 \n 10013 \n \n \n 76 \n 0 \n 190 Avenue of the Americas \n Italian Restaurant \n New York \n United States \n 40.726395 \n -74.003696 \n Bar Ciccio Alimentari \n 10013 \n \n \n 77 \n 0 \n 433 Broome St \n Tea Room \n New York \n United States \n 40.721451 \n -73.999394 \n Harney & Sons \n 10013 \n \n \n 78 \n 0 \n 512 Broadway \n Clothing Store \n New York \n United States \n 40.722491 \n -73.999071 \n AllSaints \n 10012 \n \n \n 79 \n 0 \n 131 Sullivan St \n New American Restaurant \n New York \n United States \n 40.726542 \n -74.002252 \n The Dutch \n 10012 \n \n \n 80 \n 0 \n 454 W Broadway \n Cosmetics Shop \n New York \n United States \n 40.726182 \n -74.000795 \n Benefit Cosmetics \n 10012 \n \n \n 81 \n 0 \n 131 Mercer St \n Clothing Store \n New York \n United States \n 40.724413 \n -73.998758 \n A.P.C. \n 10012 \n \n \n 82 \n 0 \n 121 Greene St \n Optical Shop \n New York \n United States \n 40.725390 \n -73.999140 \n Warby Parker \n 10012 \n \n \n 83 \n 0 \n 101 Prince St \n Watch Shop \n New York \n United States \n 40.724898 \n -73.999035 \n Shinola Soho \n 10012 \n \n \n 84 \n 0 \n 45 Crosby St \n Cycle Studio \n New York \n United States \n 40.721899 \n -73.998717 \n SoulCycle SoHo \n 10012 \n \n \n 85 \n 0 \n 319 Church St \n Coffee Shop \n New York \n United States \n 40.719829 \n -74.003854 \n La Colombe Torrefaction \n 10013 \n \n \n 86 \n 0 \n 50 Varick St \n Event Space \n New York \n United States \n 40.720915 \n -74.006207 \n Spring Studios \n 10013 \n \n \n 87 \n 0 \n 463 W Broadway \n Bagel Shop \n New York \n United States \n 40.726316 \n -74.000357 \n Sadelle's \n 10012 \n \n \n 88 \n 0 \n 311 Church St \n Asian Restaurant \n New York \n United States \n 40.719759 \n -74.003981 \n Macao Trading Co. \n 10013 \n \n \n 89 \n 0 \n 32 Avenue of the Americas \n Theater \n New York \n United States \n 40.720054 \n -74.004339 \n The Drama League Theater Center \n 10013 \n \n \n 90 \n 0 \n 99 Prince St \n American Restaurant \n New York \n United States \n 40.724688 \n -73.998675 \n Mercer Kitchen \n 10012 \n \n \n 91 \n 0 \n 142 Mercer St \n Seafood Restaurant \n New York \n United States \n 40.724572 \n -73.998469 \n Lure Fishbar \n 10012 \n \n \n 92 \n 0 \n 127 Grand St \n Vegetarian / Vegan Restaurant \n New York \n United States \n 40.720545 \n -74.000138 \n Le Botaniste \n 10013 \n \n \n 93 \n 0 \n 103 Prince Street \n Electronics Store \n New York \n United States \n 40.725058 \n -73.999029 \n Apple SoHo \n 10012 \n \n \n 94 \n 0 \n 80 Spring St \n French Restaurant \n New York \n United States \n 40.722724 \n -73.998170 \n Balthazar \n 10012 \n \n \n 95 \n 0 \n 458 W Broadway \n Salon / Barbershop \n New York \n United States \n 40.726214 \n -74.000616 \n Serenity Salon \n 10012 \n \n \n 96 \n 0 \n 155 Varick St \n Wine Bar \n New York \n United States \n 40.726240 \n -74.005773 \n City Winery \n 10013 \n \n \n 97 \n 0 \n 31 Crosby St \n Clothing Store \n New York \n United States \n 40.720746 \n -73.999346 \n Saturdays Surf NYC \n 10013 \n \n \n 98 \n 0 \n 199 Prince St \n French Restaurant \n New York \n United States \n 40.726790 \n -74.002750 \n Little Prince \n 10012 \n \n \n 99 \n 0 \n 38 Macdougal St \n Mediterranean Restaurant \n New York \n United States \n 40.727083 \n -74.002914 \n Shuka \n 10012 \n \n \n
\n
100 rows \u00d7 9 columns
\n
",
"text/plain": " index Address Category \\\n0 0 459 Broome St Arts & Crafts Store \n1 0 42 Wooster St Salon / Barbershop \n2 0 466 Broome St Dance Studio \n3 0 484 Broome St Dessert Shop \n4 0 171 Spring St Tapas Restaurant \n5 0 71 Greene St Men's Store \n6 0 494 Broome St Supermarket \n7 0 148 Spring St Shoe Store \n8 0 469 Broome St Women's Store \n9 0 35 Wooster St Art Museum \n10 0 453 Broome St Men's Store \n11 0 398 W Broadway Dessert Shop \n12 0 28-26 Wooster St Art Gallery \n13 0 90 Thompson St Italian Restaurant \n14 0 512 Broome St Bakery \n15 0 76 Greene St Fl 3 Design Studio \n16 0 189 Spring St Bakery \n17 0 529 Broome St Burger Joint \n18 0 470 Broome St Art Gallery \n19 0 510 Broome St Italian Restaurant \n20 0 93 Grand St Shoe Store \n21 0 456 Broome St Boutique \n22 0 73 Thompson St Japanese Restaurant \n23 0 149 Spring St Boutique \n24 0 399 W Broadway Coffee Shop \n25 0 71 Sullivan St Falafel Restaurant \n26 0 139 Spring St Boutique \n27 0 33 Greene St Clothing Store \n28 0 477 Broome St Women's Store \n29 0 15 Thompson St. Cocktail Bar \n.. ... ... ... \n70 0 15 Mercer St Clothing Store \n71 0 1 York St Gym \n72 0 Wooster St Mexican Restaurant \n73 0 160 Prince St Bakery \n74 0 486 Broadway Women's Store \n75 0 451 Broadway Furniture / Home Store \n76 0 190 Avenue of the Americas Italian Restaurant \n77 0 433 Broome St Tea Room \n78 0 512 Broadway Clothing Store \n79 0 131 Sullivan St New American Restaurant \n80 0 454 W Broadway Cosmetics Shop \n81 0 131 Mercer St Clothing Store \n82 0 121 Greene St Optical Shop \n83 0 101 Prince St Watch Shop \n84 0 45 Crosby St Cycle Studio \n85 0 319 Church St Coffee Shop \n86 0 50 Varick St Event Space \n87 0 463 W Broadway Bagel Shop \n88 0 311 Church St Asian Restaurant \n89 0 32 Avenue of the Americas Theater \n90 0 99 Prince St American Restaurant \n91 0 142 Mercer St Seafood Restaurant \n92 0 127 Grand St Vegetarian / Vegan Restaurant \n93 0 103 Prince Street Electronics Store \n94 0 80 Spring St French Restaurant \n95 0 458 W Broadway Salon / Barbershop \n96 0 155 Varick St Wine Bar \n97 0 31 Crosby St Clothing Store \n98 0 199 Prince St French Restaurant \n99 0 38 Macdougal St Mediterranean Restaurant \n\n City Country Latitude Longitude \\\n0 New York United States 40.722326 -74.000994 \n1 New York United States 40.722371 -74.002562 \n2 New York United States 40.722578 -74.001363 \n3 New York United States 40.723101 -74.002477 \n4 New York United States 40.724800 -74.002220 \n5 New York United States 40.723427 -74.000742 \n6 New York United States 40.723192 -74.002775 \n7 New York United States 40.724261 -74.001328 \n8 New York United States 40.722630 -74.001511 \n9 New York United States 40.722393 -74.002730 \n10 New York United States 40.722173 -74.001111 \n11 New York United States 40.724523 -74.002748 \n12 New York United States 40.721780 -74.003170 \n13 New York United States 40.725223 -74.002594 \n14 New York United States 40.723516 -74.003444 \n15 New York United States 40.723466 -74.000606 \n16 New York United States 40.725163 -74.002976 \n17 New York United States 40.723897 -74.004221 \n18 New York United States 40.722607 -74.001432 \n19 New York United States 40.723426 -74.003277 \n20 New York United States 40.721534 -74.002109 \n21 New York United States 40.722279 -74.000879 \n22 New York United States 40.724566 -74.002873 \n23 New York United States 40.724372 -74.001496 \n24 New York United States 40.724292 -74.002120 \n25 New York United States 40.724523 -74.004088 \n26 New York United States 40.724289 -74.000843 \n27 New York United States 40.721688 -74.002298 \n28 New York United States 40.722684 -74.002160 \n29 New York United States 40.722671 -74.004812 \n.. ... ... ... ... \n70 New York United States 40.720585 -74.002077 \n71 New York United States 40.721128 -74.005398 \n72 New York United States 40.725482 -73.999950 \n73 New York United States 40.725968 -74.001254 \n74 New York United States 40.721557 -73.999712 \n75 New York United States 40.720590 -74.001060 \n76 New York United States 40.726395 -74.003696 \n77 New York United States 40.721451 -73.999394 \n78 New York United States 40.722491 -73.999071 \n79 New York United States 40.726542 -74.002252 \n80 New York United States 40.726182 -74.000795 \n81 New York United States 40.724413 -73.998758 \n82 New York United States 40.725390 -73.999140 \n83 New York United States 40.724898 -73.999035 \n84 New York United States 40.721899 -73.998717 \n85 New York United States 40.719829 -74.003854 \n86 New York United States 40.720915 -74.006207 \n87 New York United States 40.726316 -74.000357 \n88 New York United States 40.719759 -74.003981 \n89 New York United States 40.720054 -74.004339 \n90 New York United States 40.724688 -73.998675 \n91 New York United States 40.724572 -73.998469 \n92 New York United States 40.720545 -74.000138 \n93 New York United States 40.725058 -73.999029 \n94 New York United States 40.722724 -73.998170 \n95 New York United States 40.726214 -74.000616 \n96 New York United States 40.726240 -74.005773 \n97 New York United States 40.720746 -73.999346 \n98 New York United States 40.726790 -74.002750 \n99 New York United States 40.727083 -74.002914 \n\n Name Postal Code \n0 Purl Soho 10013 \n1 Sam Brocato Salon 10013 \n2 Dance With Me SoHo 10013 \n3 MarieBelle 10013 \n4 Boqueria 10012 \n5 ONS Clothing 10012 \n6 Sunrise Mart 10013 \n7 Dr. Martens 10012 \n8 Isabel Marant 10013 \n9 The Drawing Center 10013 \n10 SuitSupply 10013 \n11 Ladur\u00e9e 10012 \n12 Leslie+Lohman Museum of Gay & Lesbian Art 10013 \n13 San Carlo Osteria Piemonte 10012 \n14 Pi Greek Bakerie 10013 \n15 The Line \u2013 New York 10012 \n16 Dominique Ansel Bakery 10012 \n17 Black Tap 10013 \n18 Eden Fine Art 10013 \n19 Aurora 10013 \n20 The Vans DQM General 10013 \n21 Henrik Vibskov 10013 \n22 Hirohisa 10012 \n23 LF Boutique 10012 \n24 Ground Support 10012 \n25 Ba'al Cafe 10012 \n26 CHANEL 10012 \n27 Acne Studios 10013 \n28 Kirna Zab\u00eate 10013 \n29 JIMMY at The James 10013 \n.. ... ... \n70 3x1 10013 \n71 Barry's Bootcamp TriBeCa 10013 \n72 Calexico Cart 10012 \n73 Birdbath Neighborhood Green Bakery 10012 \n74 Madewell 10013 \n75 CB2 10013 \n76 Bar Ciccio Alimentari 10013 \n77 Harney & Sons 10013 \n78 AllSaints 10012 \n79 The Dutch 10012 \n80 Benefit Cosmetics 10012 \n81 A.P.C. 10012 \n82 Warby Parker 10012 \n83 Shinola Soho 10012 \n84 SoulCycle SoHo 10012 \n85 La Colombe Torrefaction 10013 \n86 Spring Studios 10013 \n87 Sadelle's 10012 \n88 Macao Trading Co. 10013 \n89 The Drama League Theater Center 10013 \n90 Mercer Kitchen 10012 \n91 Lure Fishbar 10012 \n92 Le Botaniste 10013 \n93 Apple SoHo 10012 \n94 Balthazar 10012 \n95 Serenity Salon 10012 \n96 City Winery 10013 \n97 Saturdays Surf NYC 10013 \n98 Little Prince 10012 \n99 Shuka 10012 \n\n[100 rows x 9 columns]"
},
"output_type": "execute_result"
}
],
"source": "from foursquare_api_tools import foursquare_api_tools as ft\n\n#import pandas as pd\n\nft.venues_explore(client,lat='40.7233',lng='-74.0030',limit=100)"
},
{
"execution_count": 14,
"cell_type": "code",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": "Help on module foursquare_api_tools.foursquare_api_tools in foursquare_api_tools:\n\nNAME\n foursquare_api_tools.foursquare_api_tools\n\nFUNCTIONS\n venues_explore(client, lat, lng, limit)\n funtion to get n-places using explore in foursquare, where n is the limit when calling the function.\n This returns a pandas dataframe with name, city ,country, lat, long, postal code, address and main category as columns\n\nFILE\n /opt/conda/envs/DSX-Python35/lib/python3.5/site-packages/foursquare_api_tools/foursquare_api_tools.py\n\n\n"
}
],
"source": "help(ft)"
},
{
"execution_count": 15,
"cell_type": "code",
"metadata": {},
"outputs": [
{
"execution_count": 15,
"metadata": {},
"data": {
"text/plain": "['__builtins__',\n '__cached__',\n '__doc__',\n '__file__',\n '__loader__',\n '__name__',\n '__package__',\n '__spec__',\n 'pd',\n 'venues_explore']"
},
"output_type": "execute_result"
}
],
"source": "dir(ft)"
},
{
"execution_count": 16,
"cell_type": "code",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": "/opt/conda/envs/DSX-Python35/bin/python\r\n"
}
],
"source": "!which python"
},
{
"execution_count": 17,
"cell_type": "code",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": "python: /usr/bin/python2.7 /usr/bin/python /usr/lib/python2.7 /usr/lib64/python2.7 /etc/python /usr/include/python2.7 /opt/conda/bin/python3.6m /opt/conda/bin/python3.6-config /opt/conda/bin/python3.6m-config /opt/conda/bin/python3.6 /opt/conda/bin/python /opt/conda/envs/DSX-Python35/bin/python3.5 /opt/conda/envs/DSX-Python35/bin/python3.5m-config /opt/conda/envs/DSX-Python35/bin/python3.5-config /opt/conda/envs/DSX-Python35/bin/python3.5m /opt/conda/envs/DSX-Python35/bin/python\r\n"
}
],
"source": "!whereis python"
},
{
"execution_count": null,
"cell_type": "code",
"metadata": {},
"outputs": [],
"source": ""
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.5",
"name": "python3",
"language": "python"
},
"language_info": {
"mimetype": "text/x-python",
"nbconvert_exporter": "python",
"version": "3.5.5",
"name": "python",
"file_extension": ".py",
"pygments_lexer": "ipython3",
"codemirror_mode": {
"version": 3,
"name": "ipython"
}
}
},
"nbformat": 4
}
Example output
Important
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.
Comments
Comments powered by Disqus