Problem Statement

The objective is to locate and recommend to the client which neighbourhood in New York City will be best choice to start a restaurant.

In [1]:
import pandas as pd
import numpy as np

pd.set_option('display.max_columns', None)
pd.set_option('display.max_rows', None)

import requests
from bs4 import BeautifulSoup
from geopy.geocoders import Nominatim # convert an address into latitude and longitude values
#!conda install -c conda-forge folium

import os
import folium # map rendering library
# Matplotlib and associated plotting modules

import matplotlib.pyplot as plt
import matplotlib.cm as cm
import matplotlib.colors as colors
import matplotlib as mp
import re
import csv
%matplotlib inline


print('Libraries imported.')
Libraries imported.
Neighborhoods using FourSquare API & New York City data that contains list Boroughs, Neighbourhoods along with their latitude and longitude.
In [2]:
def geo_location(address):
    # get geo location of address
    geolocator = Nominatim(user_agent="ny_explorer")
    locatidn = geolocator.geocode(address)
    latitude = location.latitude
    longitude = location.longitude
    return latitude,longitude

Define a function to intract with FourSquare API and get top 100 venues within a radius of 1000 metres for a given latitude and longitude.

In [3]:
def get_venues(lat,lng):
    
    #set variables
    radius=1000
    LIMIT=100
    CLIENT_ID = 'SJVNROHFKAQ0CZ5ULIM0V5K5IXUPI2UV1FARMVENUHS3HB4F'# Foursquare ID, note there is a daily call quota limit 
    CLIENT_SECRET ='W1H0JXEDQWHBWX1ZZYT2IXCRTWLGPSNQ2NOGQ5IA4ZKCQKEU' # Foursquare Secret, note there is a daily call quota it
    VERSION = '20180605' # Foursquare API version
    
    #url to fetch data from foursquare api
    url = 'https://api.foursquare.com/v2/venues/explore?&client_id={}&client_secret={}&v={}&ll={},{}&radius={}&limit={}'.format(
            CLIENT_ID, 
            CLIENT_SECRET, 
            VERSION, 
            lat, 
            lng, 
            radius, 
            LIMIT)
    
    # get all the data
    results = requests.get(url).json()
    venue_data=results["response"]['groups'][0]['items']
    venue_details=[]
    for row in venue_data:
        try:
            venue_id=row['venue']['id']
            venue_name=row['venue']['name']
            venue_category=row['venue']['categories'][0]['name']
            venue_details.append([venue_id,venue_name,venue_category])
        except KeyError:
            pass
        
    column_names=['ID','Name','Category']
    df = pd.DataFrame(venue_details,columns=column_names)
    return df

Define a function to get venue details like like count , rating , tip counts for a given venue id. to be used for ranking.

In [4]:
def get_venue_details(venue_id):
        
    CLIENT_ID = 'FM32E0UU4KR1WU4VZIG1F5G1J2XFMKEGNF52UGPTSQ1J1CF1'# Foursquare ID, note there is a daily call quota limit 
    CLIENT_SECRET ='R5SUZ4FBHNDVUMHP15ZKFIKI5VCQBLGPYSFGZY2LYQXMILX2' # Foursquare Secret, note there is a daily call quota it it
    VERSION = '20180605' # Foursquare API version
    
    #url to fetch data from foursquare api
    url = 'https://api.foursquare.com/v2/venues/{}?&client_id={}&client_secret={}&v={}'.format(
            venue_id,
            CLIENT_ID, 
            CLIENT_SECRET, 
            VERSION)
    
    # get all the data
    results = requests.get(url).json()
    venue_data=results['response']['venue']
    venue_details=[]
    try:
        venue_id=venue_data['id']
        venue_name=venue_data['name']
        venue_likes=venue_data['likes']['count']
        venue_rating=venue_data['rating']
        venue_tips=venue_data['tips']['count']
        venue_details.append([venue_id,venue_name,venue_likes,venue_rating,venue_tips])
    except KeyError:
        pass
        
    column_names=['ID','Name','Likes','Rating','Tips']
    df = pd.DataFrame(venue_details,columns=column_names)
    return df

Define a funtion to get the New York city data such as Boroughs, Neighborhoods along with their latitude and longitude.

In [5]:
def get_new_york_data():
    url='https://cocl.us/new_york_dataset'
    resp=requests.get(url).json()
    # all data is present in features label
    features=resp['features']
    
    # define the dataframe columns
    column_names = ['Borough', 'Neighborhood', 'Latitude', 'Longitude'] 
    # instantiate the dataframe
    new_york_data = pd.DataFrame(columns=column_names)
    
    for data in features:
        borough = data['properties']['borough'] 
        neighborhood_name = data['properties']['name']
        
        neighborhood_latlon = data['geometry']['coordinates']
        neighborhood_lat = neighborhood_latlon[1]
        neighborhood_lon = neighborhood_latlon[0]
    
        new_york_data = new_york_data.append({'Borough': borough,
                                          'Neighborhood': neighborhood_name,
                                          'Latitude': neighborhood_lat,
                                          'Longitude': neighborhood_lon}, ignore_index=True)
    
    return new_york_data
In [6]:
# get new york data
new_york_data=get_new_york_data()
In [7]:
new_york_data.head()
Out[7]:
Borough Neighborhood Latitude Longitude
0 Bronx Wakefield 40.894705 -73.847201
1 Bronx Co-op City 40.874294 -73.829939
2 Bronx Eastchester 40.887556 -73.827806
3 Bronx Fieldston 40.895437 -73.905643
4 Bronx Riverdale 40.890834 -73.912585
In [8]:
new_york_data.shape
Out[8]:
(306, 4)

Based on the dataset, there are a total of 306 different Neighborhoods in New York to select from

In [9]:
from matplotlib import pyplot as plt
plt.style.use('ggplot')

plt.figure(figsize=(9,5), dpi = 80)
# title
plt.title('Number of Neighbourhood in NYC by Borough')
#On x-axis
plt.xlabel('Borough', fontsize = 15)
#On y-axis
plt.ylabel('No.of Neighborhood', fontsize=15)
#giving a bar plot
new_york_data.groupby('Borough')['Neighborhood'].count().plot(kind='bar')
#legend
plt.legend()
plt.show()

Based on the data, Queens is the most densely populated borough in New York City with 80 neighborhoods

In [10]:
# prepare neighborhood list that contains indian restaurant
column_names=['Borough', 'Neighborhood', 'ID','Name']
indian_rest_ny=pd.DataFrame(columns=column_names)
count=1
for row in new_york_data.values.tolist():
    Borough, Neighborhood, Latitude, Longitude=row
    venues = get_venues(Latitude,Longitude)
    indian_resturants=venues[venues['Category']=='Indian Restaurant']   
    print('(',count,'/',len(new_york_data),')','Indian Resturants in '+Neighborhood+', '+Borough+':'+str(len(indian_resturants)))
    for resturant_detail in indian_resturants.values.tolist():
        id, name , category=resturant_detail
        indian_rest_ny = indian_rest_ny.append({'Borough': Borough,
                                                'Neighborhood': Neighborhood, 
                                                'ID': id,
                                                'Name' : name
                                               }, ignore_index=True)
    count+=1
( 1 / 306 ) Indian Resturants in Wakefield, Bronx:0
( 2 / 306 ) Indian Resturants in Co-op City, Bronx:0
( 3 / 306 ) Indian Resturants in Eastchester, Bronx:0
( 4 / 306 ) Indian Resturants in Fieldston, Bronx:0
( 5 / 306 ) Indian Resturants in Riverdale, Bronx:0
( 6 / 306 ) Indian Resturants in Kingsbridge, Bronx:0
( 7 / 306 ) Indian Resturants in Marble Hill, Manhattan:0
( 8 / 306 ) Indian Resturants in Woodlawn, Bronx:1
( 9 / 306 ) Indian Resturants in Norwood, Bronx:0
( 10 / 306 ) Indian Resturants in Williamsbridge, Bronx:0
( 11 / 306 ) Indian Resturants in Baychester, Bronx:0
( 12 / 306 ) Indian Resturants in Pelham Parkway, Bronx:0
( 13 / 306 ) Indian Resturants in City Island, Bronx:0
( 14 / 306 ) Indian Resturants in Bedford Park, Bronx:0
( 15 / 306 ) Indian Resturants in University Heights, Bronx:0
( 16 / 306 ) Indian Resturants in Morris Heights, Bronx:0
( 17 / 306 ) Indian Resturants in Fordham, Bronx:0
( 18 / 306 ) Indian Resturants in East Tremont, Bronx:0
( 19 / 306 ) Indian Resturants in West Farms, Bronx:0
( 20 / 306 ) Indian Resturants in High  Bridge, Bronx:0
( 21 / 306 ) Indian Resturants in Melrose, Bronx:0
( 22 / 306 ) Indian Resturants in Mott Haven, Bronx:0
( 23 / 306 ) Indian Resturants in Port Morris, Bronx:0
( 24 / 306 ) Indian Resturants in Longwood, Bronx:0
( 25 / 306 ) Indian Resturants in Hunts Point, Bronx:0
( 26 / 306 ) Indian Resturants in Morrisania, Bronx:0
( 27 / 306 ) Indian Resturants in Soundview, Bronx:0
( 28 / 306 ) Indian Resturants in Clason Point, Bronx:0
( 29 / 306 ) Indian Resturants in Throgs Neck, Bronx:0
( 30 / 306 ) Indian Resturants in Country Club, Bronx:0
( 31 / 306 ) Indian Resturants in Parkchester, Bronx:1
( 32 / 306 ) Indian Resturants in Westchester Square, Bronx:0
( 33 / 306 ) Indian Resturants in Van Nest, Bronx:0
( 34 / 306 ) Indian Resturants in Morris Park, Bronx:0
( 35 / 306 ) Indian Resturants in Belmont, Bronx:0
( 36 / 306 ) Indian Resturants in Spuyten Duyvil, Bronx:1
( 37 / 306 ) Indian Resturants in North Riverdale, Bronx:0
( 38 / 306 ) Indian Resturants in Pelham Bay, Bronx:0
( 39 / 306 ) Indian Resturants in Schuylerville, Bronx:0
( 40 / 306 ) Indian Resturants in Edgewater Park, Bronx:0
( 41 / 306 ) Indian Resturants in Castle Hill, Bronx:0
( 42 / 306 ) Indian Resturants in Olinville, Bronx:0
( 43 / 306 ) Indian Resturants in Pelham Gardens, Bronx:0
( 44 / 306 ) Indian Resturants in Concourse, Bronx:1
( 45 / 306 ) Indian Resturants in Unionport, Bronx:1
( 46 / 306 ) Indian Resturants in Edenwald, Bronx:0
( 47 / 306 ) Indian Resturants in Bay Ridge, Brooklyn:2
( 48 / 306 ) Indian Resturants in Bensonhurst, Brooklyn:0
( 49 / 306 ) Indian Resturants in Sunset Park, Brooklyn:0
( 50 / 306 ) Indian Resturants in Greenpoint, Brooklyn:0
( 51 / 306 ) Indian Resturants in Gravesend, Brooklyn:0
( 52 / 306 ) Indian Resturants in Brighton Beach, Brooklyn:1
( 53 / 306 ) Indian Resturants in Sheepshead Bay, Brooklyn:0
( 54 / 306 ) Indian Resturants in Manhattan Terrace, Brooklyn:0
( 55 / 306 ) Indian Resturants in Flatbush, Brooklyn:2
( 56 / 306 ) Indian Resturants in Crown Heights, Brooklyn:0
( 57 / 306 ) Indian Resturants in East Flatbush, Brooklyn:1
( 58 / 306 ) Indian Resturants in Kensington, Brooklyn:2
( 59 / 306 ) Indian Resturants in Windsor Terrace, Brooklyn:0
( 60 / 306 ) Indian Resturants in Prospect Heights, Brooklyn:0
( 61 / 306 ) Indian Resturants in Brownsville, Brooklyn:0
( 62 / 306 ) Indian Resturants in Williamsburg, Brooklyn:0
( 63 / 306 ) Indian Resturants in Bushwick, Brooklyn:0
( 64 / 306 ) Indian Resturants in Bedford Stuyvesant, Brooklyn:0
( 65 / 306 ) Indian Resturants in Brooklyn Heights, Brooklyn:0
( 66 / 306 ) Indian Resturants in Cobble Hill, Brooklyn:0
( 67 / 306 ) Indian Resturants in Carroll Gardens, Brooklyn:0
( 68 / 306 ) Indian Resturants in Red Hook, Brooklyn:0
( 69 / 306 ) Indian Resturants in Gowanus, Brooklyn:1
( 70 / 306 ) Indian Resturants in Fort Greene, Brooklyn:1
( 71 / 306 ) Indian Resturants in Park Slope, Brooklyn:0
( 72 / 306 ) Indian Resturants in Cypress Hills, Brooklyn:0
( 73 / 306 ) Indian Resturants in East New York, Brooklyn:0
( 74 / 306 ) Indian Resturants in Starrett City, Brooklyn:0
( 75 / 306 ) Indian Resturants in Canarsie, Brooklyn:0
( 76 / 306 ) Indian Resturants in Flatlands, Brooklyn:0
( 77 / 306 ) Indian Resturants in Mill Island, Brooklyn:0
( 78 / 306 ) Indian Resturants in Manhattan Beach, Brooklyn:0
( 79 / 306 ) Indian Resturants in Coney Island, Brooklyn:0
( 80 / 306 ) Indian Resturants in Bath Beach, Brooklyn:0
( 81 / 306 ) Indian Resturants in Borough Park, Brooklyn:0
( 82 / 306 ) Indian Resturants in Dyker Heights, Brooklyn:0
( 83 / 306 ) Indian Resturants in Gerritsen Beach, Brooklyn:0
( 84 / 306 ) Indian Resturants in Marine Park, Brooklyn:0
( 85 / 306 ) Indian Resturants in Clinton Hill, Brooklyn:2
( 86 / 306 ) Indian Resturants in Sea Gate, Brooklyn:0
( 87 / 306 ) Indian Resturants in Downtown, Brooklyn:0
( 88 / 306 ) Indian Resturants in Boerum Hill, Brooklyn:0
( 89 / 306 ) Indian Resturants in Prospect Lefferts Gardens, Brooklyn:2
( 90 / 306 ) Indian Resturants in Ocean Hill, Brooklyn:2
( 91 / 306 ) Indian Resturants in City Line, Brooklyn:2
( 92 / 306 ) Indian Resturants in Bergen Beach, Brooklyn:0
( 93 / 306 ) Indian Resturants in Midwood, Brooklyn:0
( 94 / 306 ) Indian Resturants in Prospect Park South, Brooklyn:3
( 95 / 306 ) Indian Resturants in Georgetown, Brooklyn:0
( 96 / 306 ) Indian Resturants in East Williamsburg, Brooklyn:0
( 97 / 306 ) Indian Resturants in North Side, Brooklyn:1
( 98 / 306 ) Indian Resturants in South Side, Brooklyn:1
( 99 / 306 ) Indian Resturants in Ocean Parkway, Brooklyn:0
( 100 / 306 ) Indian Resturants in Fort Hamilton, Brooklyn:1
( 101 / 306 ) Indian Resturants in Chinatown, Manhattan:0
( 102 / 306 ) Indian Resturants in Washington Heights, Manhattan:1
( 103 / 306 ) Indian Resturants in Inwood, Manhattan:0
( 104 / 306 ) Indian Resturants in Hamilton Heights, Manhattan:2
( 105 / 306 ) Indian Resturants in Manhattanville, Manhattan:2
( 106 / 306 ) Indian Resturants in Central Harlem, Manhattan:2
( 107 / 306 ) Indian Resturants in East Harlem, Manhattan:1
( 108 / 306 ) Indian Resturants in Upper East Side, Manhattan:0
( 109 / 306 ) Indian Resturants in Yorkville, Manhattan:1
( 110 / 306 ) Indian Resturants in Lenox Hill, Manhattan:0
( 111 / 306 ) Indian Resturants in Roosevelt Island, Manhattan:1
( 112 / 306 ) Indian Resturants in Upper West Side, Manhattan:3
( 113 / 306 ) Indian Resturants in Lincoln Square, Manhattan:0
( 114 / 306 ) Indian Resturants in Clinton, Manhattan:0
( 115 / 306 ) Indian Resturants in Midtown, Manhattan:1
( 116 / 306 ) Indian Resturants in Murray Hill, Manhattan:1
( 117 / 306 ) Indian Resturants in Chelsea, Manhattan:1
( 118 / 306 ) Indian Resturants in Greenwich Village, Manhattan:0
( 119 / 306 ) Indian Resturants in East Village, Manhattan:0
( 120 / 306 ) Indian Resturants in Lower East Side, Manhattan:0
( 121 / 306 ) Indian Resturants in Tribeca, Manhattan:1
( 122 / 306 ) Indian Resturants in Little Italy, Manhattan:0
( 123 / 306 ) Indian Resturants in Soho, Manhattan:0
( 124 / 306 ) Indian Resturants in West Village, Manhattan:2
( 125 / 306 ) Indian Resturants in Manhattan Valley, Manhattan:4
( 126 / 306 ) Indian Resturants in Morningside Heights, Manhattan:2
( 127 / 306 ) Indian Resturants in Gramercy, Manhattan:3
( 128 / 306 ) Indian Resturants in Battery Park City, Manhattan:0
( 129 / 306 ) Indian Resturants in Financial District, Manhattan:1
( 130 / 306 ) Indian Resturants in Astoria, Queens:1
( 131 / 306 ) Indian Resturants in Woodside, Queens:6
( 132 / 306 ) Indian Resturants in Jackson Heights, Queens:4
( 133 / 306 ) Indian Resturants in Elmhurst, Queens:1
( 134 / 306 ) Indian Resturants in Howard Beach, Queens:0
( 135 / 306 ) Indian Resturants in Corona, Queens:0
( 136 / 306 ) Indian Resturants in Forest Hills, Queens:0
( 137 / 306 ) Indian Resturants in Kew Gardens, Queens:2
( 138 / 306 ) Indian Resturants in Richmond Hill, Queens:6
( 139 / 306 ) Indian Resturants in Flushing, Queens:0
( 140 / 306 ) Indian Resturants in Long Island City, Queens:2
( 141 / 306 ) Indian Resturants in Sunnyside, Queens:1
( 142 / 306 ) Indian Resturants in East Elmhurst, Queens:0
( 143 / 306 ) Indian Resturants in Maspeth, Queens:0
( 144 / 306 ) Indian Resturants in Ridgewood, Queens:1
( 145 / 306 ) Indian Resturants in Glendale, Queens:0
( 146 / 306 ) Indian Resturants in Rego Park, Queens:1
( 147 / 306 ) Indian Resturants in Woodhaven, Queens:0
( 148 / 306 ) Indian Resturants in Ozone Park, Queens:1
( 149 / 306 ) Indian Resturants in South Ozone Park, Queens:0
( 150 / 306 ) Indian Resturants in College Point, Queens:0
( 151 / 306 ) Indian Resturants in Whitestone, Queens:0
( 152 / 306 ) Indian Resturants in Bayside, Queens:3
( 153 / 306 ) Indian Resturants in Auburndale, Queens:0
( 154 / 306 ) Indian Resturants in Little Neck, Queens:0
( 155 / 306 ) Indian Resturants in Douglaston, Queens:0
( 156 / 306 ) Indian Resturants in Glen Oaks, Queens:4
( 157 / 306 ) Indian Resturants in Bellerose, Queens:0
( 158 / 306 ) Indian Resturants in Kew Gardens Hills, Queens:1
( 159 / 306 ) Indian Resturants in Fresh Meadows, Queens:1
( 160 / 306 ) Indian Resturants in Briarwood, Queens:3
( 161 / 306 ) Indian Resturants in Jamaica Center, Queens:3
( 162 / 306 ) Indian Resturants in Oakland Gardens, Queens:0
( 163 / 306 ) Indian Resturants in Queens Village, Queens:0
( 164 / 306 ) Indian Resturants in Hollis, Queens:0
( 165 / 306 ) Indian Resturants in South Jamaica, Queens:0
( 166 / 306 ) Indian Resturants in St. Albans, Queens:0
( 167 / 306 ) Indian Resturants in Rochdale, Queens:0
( 168 / 306 ) Indian Resturants in Springfield Gardens, Queens:0
( 169 / 306 ) Indian Resturants in Cambria Heights, Queens:0
( 170 / 306 ) Indian Resturants in Rosedale, Queens:0
( 171 / 306 ) Indian Resturants in Far Rockaway, Queens:0
( 172 / 306 ) Indian Resturants in Broad Channel, Queens:0
( 173 / 306 ) Indian Resturants in Breezy Point, Queens:0
( 174 / 306 ) Indian Resturants in Steinway, Queens:1
( 175 / 306 ) Indian Resturants in Beechhurst, Queens:0
( 176 / 306 ) Indian Resturants in Bay Terrace, Queens:0
( 177 / 306 ) Indian Resturants in Edgemere, Queens:0
( 178 / 306 ) Indian Resturants in Arverne, Queens:0
( 179 / 306 ) Indian Resturants in Rockaway Beach, Queens:0
( 180 / 306 ) Indian Resturants in Neponsit, Queens:0
( 181 / 306 ) Indian Resturants in Murray Hill, Queens:0
( 182 / 306 ) Indian Resturants in Floral Park, Queens:8
( 183 / 306 ) Indian Resturants in Holliswood, Queens:1
( 184 / 306 ) Indian Resturants in Jamaica Estates, Queens:3
( 185 / 306 ) Indian Resturants in Queensboro Hill, Queens:1
( 186 / 306 ) Indian Resturants in Hillcrest, Queens:0
( 187 / 306 ) Indian Resturants in Ravenswood, Queens:1
( 188 / 306 ) Indian Resturants in Lindenwood, Queens:0
( 189 / 306 ) Indian Resturants in Laurelton, Queens:0
( 190 / 306 ) Indian Resturants in Lefrak City, Queens:0
( 191 / 306 ) Indian Resturants in Belle Harbor, Queens:0
( 192 / 306 ) Indian Resturants in Rockaway Park, Queens:0
( 193 / 306 ) Indian Resturants in Somerville, Queens:0
( 194 / 306 ) Indian Resturants in Brookville, Queens:0
( 195 / 306 ) Indian Resturants in Bellaire, Queens:1
( 196 / 306 ) Indian Resturants in North Corona, Queens:0
( 197 / 306 ) Indian Resturants in Forest Hills Gardens, Queens:1
( 198 / 306 ) Indian Resturants in St. George, Staten Island:0
( 199 / 306 ) Indian Resturants in New Brighton, Staten Island:1
( 200 / 306 ) Indian Resturants in Stapleton, Staten Island:0
( 201 / 306 ) Indian Resturants in Rosebank, Staten Island:0
( 202 / 306 ) Indian Resturants in West Brighton, Staten Island:0
( 203 / 306 ) Indian Resturants in Grymes Hill, Staten Island:0
( 204 / 306 ) Indian Resturants in Todt Hill, Staten Island:0
( 205 / 306 ) Indian Resturants in South Beach, Staten Island:0
( 206 / 306 ) Indian Resturants in Port Richmond, Staten Island:0
( 207 / 306 ) Indian Resturants in Mariner's Harbor, Staten Island:0
( 208 / 306 ) Indian Resturants in Port Ivory, Staten Island:0
( 209 / 306 ) Indian Resturants in Castleton Corners, Staten Island:0
( 210 / 306 ) Indian Resturants in New Springville, Staten Island:0
( 211 / 306 ) Indian Resturants in Travis, Staten Island:0
( 212 / 306 ) Indian Resturants in New Dorp, Staten Island:1
( 213 / 306 ) Indian Resturants in Oakwood, Staten Island:0
( 214 / 306 ) Indian Resturants in Great Kills, Staten Island:0
( 215 / 306 ) Indian Resturants in Eltingville, Staten Island:0
( 216 / 306 ) Indian Resturants in Annadale, Staten Island:0
( 217 / 306 ) Indian Resturants in Woodrow, Staten Island:0
( 218 / 306 ) Indian Resturants in Tottenville, Staten Island:0
( 219 / 306 ) Indian Resturants in Tompkinsville, Staten Island:1
( 220 / 306 ) Indian Resturants in Silver Lake, Staten Island:0
( 221 / 306 ) Indian Resturants in Sunnyside, Staten Island:0
( 222 / 306 ) Indian Resturants in Ditmas Park, Brooklyn:4
( 223 / 306 ) Indian Resturants in Wingate, Brooklyn:0
( 224 / 306 ) Indian Resturants in Rugby, Brooklyn:0
( 225 / 306 ) Indian Resturants in Park Hill, Staten Island:0
( 226 / 306 ) Indian Resturants in Westerleigh, Staten Island:0
( 227 / 306 ) Indian Resturants in Graniteville, Staten Island:0
( 228 / 306 ) Indian Resturants in Arlington, Staten Island:0
( 229 / 306 ) Indian Resturants in Arrochar, Staten Island:0
( 230 / 306 ) Indian Resturants in Grasmere, Staten Island:0
( 231 / 306 ) Indian Resturants in Old Town, Staten Island:0
( 232 / 306 ) Indian Resturants in Dongan Hills, Staten Island:0
( 233 / 306 ) Indian Resturants in Midland Beach, Staten Island:0
( 234 / 306 ) Indian Resturants in Grant City, Staten Island:1
( 235 / 306 ) Indian Resturants in New Dorp Beach, Staten Island:0
( 236 / 306 ) Indian Resturants in Bay Terrace, Staten Island:0
( 237 / 306 ) Indian Resturants in Huguenot, Staten Island:0
( 238 / 306 ) Indian Resturants in Pleasant Plains, Staten Island:0
( 239 / 306 ) Indian Resturants in Butler Manor, Staten Island:0
( 240 / 306 ) Indian Resturants in Charleston, Staten Island:0
( 241 / 306 ) Indian Resturants in Rossville, Staten Island:0
( 242 / 306 ) Indian Resturants in Arden Heights, Staten Island:0
( 243 / 306 ) Indian Resturants in Greenridge, Staten Island:0
( 244 / 306 ) Indian Resturants in Heartland Village, Staten Island:0
( 245 / 306 ) Indian Resturants in Chelsea, Staten Island:0
( 246 / 306 ) Indian Resturants in Bloomfield, Staten Island:0
( 247 / 306 ) Indian Resturants in Bulls Head, Staten Island:0
( 248 / 306 ) Indian Resturants in Carnegie Hill, Manhattan:2
( 249 / 306 ) Indian Resturants in Noho, Manhattan:0
( 250 / 306 ) Indian Resturants in Civic Center, Manhattan:1
( 251 / 306 ) Indian Resturants in Midtown South, Manhattan:1
( 252 / 306 ) Indian Resturants in Richmond Town, Staten Island:0
( 253 / 306 ) Indian Resturants in Shore Acres, Staten Island:0
( 254 / 306 ) Indian Resturants in Clifton, Staten Island:0
( 255 / 306 ) Indian Resturants in Concord, Staten Island:0
( 256 / 306 ) Indian Resturants in Emerson Hill, Staten Island:0
( 257 / 306 ) Indian Resturants in Randall Manor, Staten Island:0
( 258 / 306 ) Indian Resturants in Howland Hook, Staten Island:0
( 259 / 306 ) Indian Resturants in Elm Park, Staten Island:0
( 260 / 306 ) Indian Resturants in Remsen Village, Brooklyn:0
( 261 / 306 ) Indian Resturants in New Lots, Brooklyn:0
( 262 / 306 ) Indian Resturants in Paerdegat Basin, Brooklyn:0
( 263 / 306 ) Indian Resturants in Mill Basin, Brooklyn:0
( 264 / 306 ) Indian Resturants in Jamaica Hills, Queens:4
( 265 / 306 ) Indian Resturants in Utopia, Queens:0
( 266 / 306 ) Indian Resturants in Pomonok, Queens:0
( 267 / 306 ) Indian Resturants in Astoria Heights, Queens:1
( 268 / 306 ) Indian Resturants in Claremont Village, Bronx:0
( 269 / 306 ) Indian Resturants in Concourse Village, Bronx:1
( 270 / 306 ) Indian Resturants in Mount Eden, Bronx:0
( 271 / 306 ) Indian Resturants in Mount Hope, Bronx:0
( 272 / 306 ) Indian Resturants in Sutton Place, Manhattan:2
( 273 / 306 ) Indian Resturants in Hunters Point, Queens:0
( 274 / 306 ) Indian Resturants in Turtle Bay, Manhattan:3
( 275 / 306 ) Indian Resturants in Tudor City, Manhattan:2
( 276 / 306 ) Indian Resturants in Stuyvesant Town, Manhattan:0
( 277 / 306 ) Indian Resturants in Flatiron, Manhattan:0
( 278 / 306 ) Indian Resturants in Sunnyside Gardens, Queens:1
( 279 / 306 ) Indian Resturants in Blissville, Queens:1
( 280 / 306 ) Indian Resturants in Fulton Ferry, Brooklyn:0
( 281 / 306 ) Indian Resturants in Vinegar Hill, Brooklyn:0
( 282 / 306 ) Indian Resturants in Weeksville, Brooklyn:0
( 283 / 306 ) Indian Resturants in Broadway Junction, Brooklyn:0
( 284 / 306 ) Indian Resturants in Dumbo, Brooklyn:0
( 285 / 306 ) Indian Resturants in Manor Heights, Staten Island:0
( 286 / 306 ) Indian Resturants in Willowbrook, Staten Island:0
( 287 / 306 ) Indian Resturants in Sandy Ground, Staten Island:0
( 288 / 306 ) Indian Resturants in Egbertville, Staten Island:0
( 289 / 306 ) Indian Resturants in Roxbury, Queens:0
( 290 / 306 ) Indian Resturants in Homecrest, Brooklyn:0
( 291 / 306 ) Indian Resturants in Middle Village, Queens:0
( 292 / 306 ) Indian Resturants in Prince's Bay, Staten Island:0
( 293 / 306 ) Indian Resturants in Lighthouse Hill, Staten Island:0
( 294 / 306 ) Indian Resturants in Richmond Valley, Staten Island:0
( 295 / 306 ) Indian Resturants in Malba, Queens:0
( 296 / 306 ) Indian Resturants in Highland Park, Brooklyn:0
( 297 / 306 ) Indian Resturants in Madison, Brooklyn:0
( 298 / 306 ) Indian Resturants in Bronxdale, Bronx:0
( 299 / 306 ) Indian Resturants in Allerton, Bronx:0
( 300 / 306 ) Indian Resturants in Kingsbridge Heights, Bronx:0
( 301 / 306 ) Indian Resturants in Erasmus, Brooklyn:1
( 302 / 306 ) Indian Resturants in Hudson Yards, Manhattan:0
( 303 / 306 ) Indian Resturants in Hammels, Queens:0
( 304 / 306 ) Indian Resturants in Bayswater, Queens:0
( 305 / 306 ) Indian Resturants in Queensbridge, Queens:2
( 306 / 306 ) Indian Resturants in Fox Hills, Staten Island:0
In [11]:
indian_rest_ny.head()
Out[11]:
Borough Neighborhood ID Name
0 Bronx Woodlawn 4c0448d9310fc9b6bf1dc761 Curry Spot
1 Bronx Parkchester 4c194631838020a13e78e561 Melanies Roti Bar And Grill
2 Bronx Spuyten Duyvil 4c04544df423a593ac83d116 Cumin Indian Cuisine
3 Bronx Concourse 551b7f75498e86c00a0ed2e1 Hungry Bird
4 Bronx Unionport 4c194631838020a13e78e561 Melanies Roti Bar And Grill
In [12]:
indian_rest_ny.shape
Out[12]:
(146, 4)
In [13]:
from matplotlib import pyplot as plt
plt.style.use('ggplot')

plt.figure(figsize=(9,5), dpi = 100)
# title
plt.title('Number of Indian Restaurants in NYC by Borough')
#On x-axis
plt.xlabel('Borough', fontsize = 15)
#On y-axis
plt.ylabel('No.of Indian Restaurant', fontsize=15)
#giving a bar plot
indian_rest_ny.groupby('Borough')['ID'].count().plot(kind='bar')
#legend
plt.legend()
#displays the plot
plt.show()

It is noted that Queens has the highest number of Indian Restaurants.

In [14]:
indian_rest_ny[indian_rest_ny['Neighborhood']=='Floral Park']
Out[14]:
Borough Neighborhood ID Name
100 Queens Floral Park 4e4e3e22bd4101d0d7a5c2d1 Kerala Kitchen
101 Queens Floral Park 527ffc0811d2d329d5e49abd Jackson Diner
102 Queens Floral Park 4b647b56f964a520c4b62ae3 Usha Foods & Usha Sweets
103 Queens Floral Park 4b787c49f964a5209cd12ee3 Santoor Indian Restaurant
104 Queens Floral Park 4c0c01e0bbc676b00d6b4cd5 Mumbai Xpress
105 Queens Floral Park 4c76ff35a5676dcb72671721 Flavor Of India
106 Queens Floral Park 4df0f39dd4c04d0392c853ea Sagar Chinese
107 Queens Floral Park 4e6bfe1c7d8b2c711b17bbe5 Surya sweets and snacks
In [15]:
from matplotlib import pyplot as plt
plt.style.use('ggplot')

plt.figure(figsize=(9,5), dpi = 100)
# title
plt.title('Number of Indian Restaurants in NYC by Neighbourhood')
#On x-axis
plt.xlabel('Neighborhood', fontsize = 15)
#On y-axis
plt.ylabel('No.of Indian Restaurants', fontsize=15)
#giving a bar plot
indian_rest_ny.groupby('Neighborhood')['ID'].count().nlargest(5).plot(kind='bar')
#legend
plt.legend()
#displays the plot
plt.show()

Floral Park in Queens has the most Indian Resturants with a total count of 11.

In [16]:
# prepare neighborhood list that contains indian resturants
column_names=['Borough', 'Neighborhood', 'ID','Name','Likes','Rating','Tips']
indian_rest_stats_ny=pd.DataFrame(columns=column_names)
count=1


for row in indian_rest_ny.values.tolist():
    Borough,Neighborhood,ID,Name=row

    # prepare neighborhood list that contains indian resturants
column_names=['Borough', 'Neighborhood', 'ID','Name','Likes','Rating','Tips']
indian_rest_stats_ny=pd.DataFrame(columns=column_names)
count=1


for row in indian_rest_ny.values.tolist():
    Borough,Neighborhood,ID,Name=row
    try:
        venue_details=get_venue_details(ID)
        print(venue_details)
        id,name,likes,rating,tips=venue_details.values.tolist()[0]
    except (IndexError, KeyError) as e:
        print('No data available for id=',ID)
        # we will assign 0 value for these resturants as they may have been 
        #recently opened or details does not exist in FourSquare Database
        id,name,likes,rating,tips=[0]*5
    print('(',count,'/',len(indian_rest_ny),')','processed')
    indian_rest_stats_ny = indian_rest_stats_ny.append({'Borough': Borough,
                                                'Neighborhood': Neighborhood, 
                                                'ID': id,
                                                'Name' : name,
                                                'Likes' : likes,
                                                'Rating' : rating,
                                                'Tips' : tips
                                               }, ignore_index=True)
    count+=1
                         ID        Name  Likes  Rating  Tips
0  4c0448d9310fc9b6bf1dc761  Curry Spot      4     8.0    11
( 1 / 146 ) processed
                         ID                         Name  Likes  Rating  Tips
0  4c194631838020a13e78e561  Melanies Roti Bar And Grill      3     6.3     2
( 2 / 146 ) processed
                         ID                  Name  Likes  Rating  Tips
0  4c04544df423a593ac83d116  Cumin Indian Cuisine     13     6.1     9
( 3 / 146 ) processed
                         ID         Name  Likes  Rating  Tips
0  551b7f75498e86c00a0ed2e1  Hungry Bird      8     7.4     3
( 4 / 146 ) processed
                         ID                         Name  Likes  Rating  Tips
0  4c194631838020a13e78e561  Melanies Roti Bar And Grill      3     6.3     2
( 5 / 146 ) processed
                         ID       Name  Likes  Rating  Tips
0  4b5a4dc8f964a520a2bb28e3  Taj Mahal     38     8.3    26
( 6 / 146 ) processed
                         ID          Name  Likes  Rating  Tips
0  545835a1498e820edc6f636f  Bombay Grill     14     7.3     4
( 7 / 146 ) processed
                         ID          Name  Likes  Rating  Tips
0  4af0d31bf964a5207ddf21e3  Pak Nasheman      9     7.6     4
( 8 / 146 ) processed
                         ID          Name  Likes  Rating  Tips
0  52213c4211d295d4c57a607c  Ashoka Grill      8     7.3    14
( 9 / 146 ) processed
                         ID                Name  Likes  Rating  Tips
0  564d283d498e6e851df79d87  Great Indian Curry      3     6.7     2
( 10 / 146 ) processed
                         ID          Name  Likes  Rating  Tips
0  512a9ea9e4b004fb8eeb84e5  Silver Krust     12     8.3     3
( 11 / 146 ) processed
                         ID       Name  Likes  Rating  Tips
0  4db0f4371e729fcc56497f20  Mashallah     19     7.7     7
( 12 / 146 ) processed
                         ID                          Name  Likes  Rating  Tips
0  4b718914f964a520c04b2de3  Madina Restaurant and Sweets     17     7.1    12
( 13 / 146 ) processed
                         ID                       Name  Likes  Rating  Tips
0  52f18573498ec2c34e830ffd  Kanan's Indian Restaurant     23     7.9     8
( 14 / 146 ) processed
                         ID         Name  Likes  Rating  Tips
0  57596dad498e732300496b23  Dosa Royale     71     8.6    21
( 15 / 146 ) processed
                         ID           Name  Likes  Rating  Tips
0  568d3902498e619efcbc3f58  Spice & Grill     19     8.1     6
( 16 / 146 ) processed
                         ID         Name  Likes  Rating  Tips
0  57596dad498e732300496b23  Dosa Royale     71     8.6    21
( 17 / 146 ) processed
                         ID                        Name  Likes  Rating  Tips
0  4bb93b70cf2fc9b6fe64a002  Gandhi Fine Indian Cuisine     80     8.7    45
( 18 / 146 ) processed
                         ID     Name  Likes  Rating  Tips
0  4ec80587d3e3e131f2e72835  Bayleaf      6     7.0     7
( 19 / 146 ) processed
                         ID             Name  Likes  Rating  Tips
0  5539753f498edbace4746b67  Tandoori Masala     12     8.3     2
( 20 / 146 ) processed
                         ID           Name  Likes  Rating  Tips
0  4f6cae2ee4b0d4a5afcef5c0  Delhi Heights     22     8.2     8
( 21 / 146 ) processed
Empty DataFrame
Columns: [ID, Name, Likes, Rating, Tips]
Index: []
No data available for id= 4e4e4c8fbd4101d0d7a726b3
( 22 / 146 ) processed
Empty DataFrame
Columns: [ID, Name, Likes, Rating, Tips]
Index: []
No data available for id= 4f381772e4b08533d2f91e26
( 23 / 146 ) processed
                         ID                     Name  Likes  Rating  Tips
0  519ff6c8498e1300ddcbd45c  Anarkali Indian Cuisine     14     7.9     8
( 24 / 146 ) processed
                         ID       Name  Likes  Rating  Tips
0  4db0f4371e729fcc56497f20  Mashallah     19     7.7     7
( 25 / 146 ) processed
                         ID                          Name  Likes  Rating  Tips
0  4b718914f964a520c04b2de3  Madina Restaurant and Sweets     17     7.1    12
( 26 / 146 ) processed
                         ID                Name  Likes  Rating  Tips
0  5631511b498e3d6d7e0a4df0  Tikka Indian Grill     94     8.7    26
( 27 / 146 ) processed
                         ID                Name  Likes  Rating  Tips
0  5631511b498e3d6d7e0a4df0  Tikka Indian Grill     94     8.7    26
( 28 / 146 ) processed
                         ID          Name  Likes  Rating  Tips
0  545835a1498e820edc6f636f  Bombay Grill     14     7.3     4
( 29 / 146 ) processed
                         ID                      Name  Likes  Rating  Tips
0  4ae7876ef964a5201eac21e3  Kismat Indian Restaurant     45     7.9    24
( 30 / 146 ) processed
                         ID                           Name  Likes  Rating  \
0  54c2bd96498eaf5142e3fe92  Clove Indian Restaurant & Bar     29     7.6   

   Tips  
0    15  
( 31 / 146 ) processed
                         ID           Name  Likes  Rating  Tips
0  5914ff32b23dfa207eca38de  Mumbai Masala     13     7.4     6
( 32 / 146 ) processed
                         ID                 Name  Likes  Rating  Tips
0  529d382a11d2dd5ef107e641  Chapati House - NYC     73     8.0    18
( 33 / 146 ) processed
                         ID                           Name  Likes  Rating  \
0  54c2bd96498eaf5142e3fe92  Clove Indian Restaurant & Bar     29     7.6   

   Tips  
0    15  
( 34 / 146 ) processed
                         ID          Name  Likes  Rating  Tips
0  56d87f3d498ee215abee5724  Delhi Masala     13     8.6     3
( 35 / 146 ) processed
                         ID                           Name  Likes  Rating  \
0  54c2bd96498eaf5142e3fe92  Clove Indian Restaurant & Bar     29     7.6   

   Tips  
0    15  
( 36 / 146 ) processed
                         ID      Name  Likes  Rating  Tips
0  519fe6f5498e30595d370c44  Bawarchi      9     7.7     4
( 37 / 146 ) processed
                         ID            Name  Likes  Rating  Tips
0  5272ca4511d22488f6895caf  Drunken Munkey    206     8.5    61
( 38 / 146 ) processed
                         ID              Name  Likes  Rating  Tips
0  4fe4fb50c2eee335e4fea69d  Moti Mahal Delux    183     8.4    81
( 39 / 146 ) processed
                         ID    Name  Likes  Rating  Tips
0  591890f43abcaf1ddca66e85  Ashoka     19     8.5     9
( 40 / 146 ) processed
                         ID    Name  Likes  Rating  Tips
0  42489a80f964a5208b201fe3  Swagat    105     8.5    38
( 41 / 146 ) processed
                         ID           Name  Likes  Rating  Tips
0  4b0dec08f964a520ae5223e3  Alachi Masala     18     7.6    17
( 42 / 146 ) processed
                         ID                   Name  Likes  Rating  Tips
0  49d91c12f964a520015e1fe3  The Kati Roll Company    832     8.8   258
( 43 / 146 ) processed
                         ID                   Name  Likes  Rating  Tips
0  59fcd48c464d6567ed2f5e37  The Kati Roll Company     16     8.8     2
( 44 / 146 ) processed
                         ID               Name  Likes  Rating  Tips
0  4b4aab62f964a520978c26e3  Dil-e Punjab Deli    104     8.7    42
( 45 / 146 ) processed
                         ID              Name  Likes  Rating  Tips
0  4bbb9dbded7776b0e1ad3e51  Tamarind TriBeCa    581     9.0   145
( 46 / 146 ) processed
                         ID                Name  Likes  Rating  Tips
0  5b5a2c9e66f3cd002ca0aab5  The Drunken Munkey     20     8.7     3
( 47 / 146 ) processed
                         ID  Name  Likes  Rating  Tips
0  591794df2be42556988e4a8e  Rahi     96     8.8    15
( 48 / 146 ) processed
                         ID              Name  Likes  Rating  Tips
0  424de080f964a520ae201fe3  Manhattan Valley     42     7.9    30
( 49 / 146 ) processed
                         ID        Name  Likes  Rating  Tips
0  4d24b812836f5481518645f7  Doaba Deli     41     7.4    13
( 50 / 146 ) processed
No data available for id= 538ba1f2498e279098e4210a
( 51 / 146 ) processed
No data available for id= 49c5ad0af964a5201b571fe3
( 52 / 146 ) processed
No data available for id= 49c5ad0af964a5201b571fe3
( 53 / 146 ) processed
No data available for id= 529d382a11d2dd5ef107e641
( 54 / 146 ) processed
No data available for id= 4a70a75bf964a52016d81fe3
( 55 / 146 ) processed
No data available for id= 57f7cbbe498edf8f07c7ba83
( 56 / 146 ) processed
No data available for id= 523b2b42498e1dfabcc8ab15
( 57 / 146 ) processed
No data available for id= 5b770657c0cacb002c89bc63
( 58 / 146 ) processed
No data available for id= 4aa56c81f964a5204e4820e3
( 59 / 146 ) processed
No data available for id= 4afdcf29f964a520162b22e3
( 60 / 146 ) processed
No data available for id= 4c7060e734443704ca0e245f
( 61 / 146 ) processed
No data available for id= 4b998d3ff964a520fc8235e3
( 62 / 146 ) processed
No data available for id= 49ebb18ff964a52016671fe3
( 63 / 146 ) processed
No data available for id= 3fd66200f964a52009f11ee3
( 64 / 146 ) processed
No data available for id= 4b189424f964a52043d423e3
( 65 / 146 ) processed
No data available for id= 527d9cbc498edf0db10bde6b
( 66 / 146 ) processed
No data available for id= 4afdcf29f964a520162b22e3
( 67 / 146 ) processed
No data available for id= 4b998d3ff964a520fc8235e3
( 68 / 146 ) processed
No data available for id= 49ebb18ff964a52016671fe3
( 69 / 146 ) processed
No data available for id= 527d9cbc498edf0db10bde6b
( 70 / 146 ) processed
No data available for id= 5782c9ce498edde587f5aa14
( 71 / 146 ) processed
No data available for id= 4bbe78bfba9776b070cefdc8
( 72 / 146 ) processed
No data available for id= 4b522029f964a520f26927e3
( 73 / 146 ) processed
No data available for id= 4f1b77d7e4b044fd359e6d21
( 74 / 146 ) processed
No data available for id= 5782c9ce498edde587f5aa14
( 75 / 146 ) processed
No data available for id= 4bb2bc48a32876b02e0b01fe
( 76 / 146 ) processed
No data available for id= 4babc24ef964a5200ac73ae3
( 77 / 146 ) processed
No data available for id= 4adbaef0f964a520ff2921e3
( 78 / 146 ) processed
No data available for id= 50a287a7e4b0033f830f06db
( 79 / 146 ) processed
No data available for id= 5b931ea69d7468002c3b1382
( 80 / 146 ) processed
No data available for id= 5b931ea69d7468002c3b1382
( 81 / 146 ) processed
No data available for id= 50e1c9708aca7ff2b3e50353
( 82 / 146 ) processed
No data available for id= 5625af69498ebbc62b61a382
( 83 / 146 ) processed
No data available for id= 572d7c21498e098658a0edd7
( 84 / 146 ) processed
No data available for id= 4f1f4996e4b01ff351a7a50c
( 85 / 146 ) processed
No data available for id= 539a4ff0498e79c6745baba9
( 86 / 146 ) processed
No data available for id= 539e27b0498e2eba582085ee
( 87 / 146 ) processed
No data available for id= 4b787c49f964a5209cd12ee3
( 88 / 146 ) processed
No data available for id= 4b9030abf964a520397b33e3
( 89 / 146 ) processed
No data available for id= 4df0f39dd4c04d0392c853ea
( 90 / 146 ) processed
No data available for id= 4c0e256ab1b676b06589e186
( 91 / 146 ) processed
No data available for id= 4b96926df964a520abd534e3
( 92 / 146 ) processed
No data available for id= 5401515e498e60d0fe0abe3b
( 93 / 146 ) processed
No data available for id= 4be334312fc7d13a7a81083a
( 94 / 146 ) processed
No data available for id= 4bad49a0f964a52041423be3
( 95 / 146 ) processed
No data available for id= 4cc08b0900d83704ed474b5c
( 96 / 146 ) processed
No data available for id= 4bad49a0f964a52041423be3
( 97 / 146 ) processed
No data available for id= 4c434b2bd691c9b6ef8f8f0a
( 98 / 146 ) processed
No data available for id= 4cc08b0900d83704ed474b5c
( 99 / 146 ) processed
No data available for id= 562035d9498e2abb4137c2c7
( 100 / 146 ) processed
No data available for id= 4e4e3e22bd4101d0d7a5c2d1
( 101 / 146 ) processed
No data available for id= 527ffc0811d2d329d5e49abd
( 102 / 146 ) processed
No data available for id= 4b647b56f964a520c4b62ae3
( 103 / 146 ) processed
No data available for id= 4b787c49f964a5209cd12ee3
( 104 / 146 ) processed
No data available for id= 4c0c01e0bbc676b00d6b4cd5
( 105 / 146 ) processed
No data available for id= 4c76ff35a5676dcb72671721
( 106 / 146 ) processed
No data available for id= 4df0f39dd4c04d0392c853ea
( 107 / 146 ) processed
No data available for id= 4e6bfe1c7d8b2c711b17bbe5
( 108 / 146 ) processed
No data available for id= 4f580c1be4b0bdfd0e7e8102
( 109 / 146 ) processed
No data available for id= 4c434b2bd691c9b6ef8f8f0a
( 110 / 146 ) processed
No data available for id= 4f44d0f619836ed00196b6a9
( 111 / 146 ) processed
No data available for id= 4b8d5734f964a520b1f532e3
( 112 / 146 ) processed
No data available for id= 4a215243f964a520d17c1fe3
( 113 / 146 ) processed
No data available for id= 5623f6f9498e5a44a08bfae8
( 114 / 146 ) processed
No data available for id= 4dc0aaedae606fe8b71c226b
( 115 / 146 ) processed
No data available for id= 4f188adfe4b0cae4b525a694
( 116 / 146 ) processed
No data available for id= 4b9be038f964a520393036e3
( 117 / 146 ) processed
No data available for id= 4be74a502468c928505a0243
( 118 / 146 ) processed
No data available for id= 4b9be038f964a520393036e3
( 119 / 146 ) processed
No data available for id= 519ff6c8498e1300ddcbd45c
( 120 / 146 ) processed
No data available for id= 4db0f4371e729fcc56497f20
( 121 / 146 ) processed
No data available for id= 4b718914f964a520c04b2de3
( 122 / 146 ) processed
No data available for id= 564d283d498e6e851df79d87
( 123 / 146 ) processed
No data available for id= 4be74a502468c928505a0243
( 124 / 146 ) processed
No data available for id= 5272ca4511d22488f6895caf
( 125 / 146 ) processed
No data available for id= 56ed855a498ef3bb022352c3
( 126 / 146 ) processed
No data available for id= 4bbb9dbded7776b0e1ad3e51
( 127 / 146 ) processed
No data available for id= 49d91c12f964a520015e1fe3
( 128 / 146 ) processed
No data available for id= 4bad49a0f964a52041423be3
( 129 / 146 ) processed
No data available for id= 4c434b2bd691c9b6ef8f8f0a
( 130 / 146 ) processed
No data available for id= 4cc08b0900d83704ed474b5c
( 131 / 146 ) processed
No data available for id= 4cb4a712db32f04dcb5adf4d
( 132 / 146 ) processed
No data available for id= 4c2e8df2213c2d7f94742f5d
( 133 / 146 ) processed
No data available for id= 551b7f75498e86c00a0ed2e1
( 134 / 146 ) processed
No data available for id= 4fe4fb50c2eee335e4fea69d
( 135 / 146 ) processed
No data available for id= 4f57f98fe4b0bd50f6bb8b31
( 136 / 146 ) processed
No data available for id= 59fcd48c464d6567ed2f5e37
( 137 / 146 ) processed
No data available for id= 5ac3984ae57ca64be4dc6168
( 138 / 146 ) processed
No data available for id= 4f57f98fe4b0bd50f6bb8b31
( 139 / 146 ) processed
No data available for id= 59fcd48c464d6567ed2f5e37
( 140 / 146 ) processed
No data available for id= 5ac3984ae57ca64be4dc6168
( 141 / 146 ) processed
No data available for id= 4c48da9f3013a59356c5f0e1
( 142 / 146 ) processed
No data available for id= 5b931ea69d7468002c3b1382
( 143 / 146 ) processed
No data available for id= 564d283d498e6e851df79d87
( 144 / 146 ) processed
No data available for id= 50a287a7e4b0033f830f06db
( 145 / 146 ) processed
No data available for id= 4b1b341bf964a5208af923e3
( 146 / 146 ) processed
In [17]:
indian_rest_stats_ny.head()
Out[17]:
Borough Neighborhood ID Name Likes Rating Tips
0 Bronx Woodlawn 4c0448d9310fc9b6bf1dc761 Curry Spot 4 8.0 11
1 Bronx Parkchester 4c194631838020a13e78e561 Melanies Roti Bar And Grill 3 6.3 2
2 Bronx Spuyten Duyvil 4c04544df423a593ac83d116 Cumin Indian Cuisine 13 6.1 9
3 Bronx Concourse 551b7f75498e86c00a0ed2e1 Hungry Bird 8 7.4 3
4 Bronx Unionport 4c194631838020a13e78e561 Melanies Roti Bar And Grill 3 6.3 2
In [18]:
indian_rest_stats_ny.shape
Out[18]:
(146, 7)
In [19]:
indian_rest_ny.shape
Out[19]:
(146, 4)
In [20]:
indian_rest_stats_ny.to_csv('indian_rest_stats_ny.csv', index=False)
In [21]:
indian_rest_stats_ny_csv=pd.read_csv('indian_rest_stats_ny.csv')
In [22]:
indian_rest_stats_ny_csv.shape
Out[22]:
(146, 7)
In [23]:
indian_rest_stats_ny_csv.head()
Out[23]:
Borough Neighborhood ID Name Likes Rating Tips
0 Bronx Woodlawn 4c0448d9310fc9b6bf1dc761 Curry Spot 4 8.0 11
1 Bronx Parkchester 4c194631838020a13e78e561 Melanies Roti Bar And Grill 3 6.3 2
2 Bronx Spuyten Duyvil 4c04544df423a593ac83d116 Cumin Indian Cuisine 13 6.1 9
3 Bronx Concourse 551b7f75498e86c00a0ed2e1 Hungry Bird 8 7.4 3
4 Bronx Unionport 4c194631838020a13e78e561 Melanies Roti Bar And Grill 3 6.3 2
In [24]:
indian_rest_stats_ny.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 146 entries, 0 to 145
Data columns (total 7 columns):
Borough         146 non-null object
Neighborhood    146 non-null object
ID              146 non-null object
Name            146 non-null object
Likes           146 non-null object
Rating          146 non-null float64
Tips            146 non-null object
dtypes: float64(1), object(6)
memory usage: 8.1+ KB
In [25]:
indian_rest_stats_ny['Likes']=indian_rest_stats_ny['Likes'].astype('float64')
In [26]:
indian_rest_stats_ny['Tips']=indian_rest_stats_ny['Tips'].astype('float64')
In [27]:
indian_rest_stats_ny.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 146 entries, 0 to 145
Data columns (total 7 columns):
Borough         146 non-null object
Neighborhood    146 non-null object
ID              146 non-null object
Name            146 non-null object
Likes           146 non-null float64
Rating          146 non-null float64
Tips            146 non-null float64
dtypes: float64(3), object(4)
memory usage: 8.1+ KB
In [28]:
# Restaurants with maximum Likes
indian_rest_stats_ny.iloc[indian_rest_stats_ny['Likes'].idxmax()]
Out[28]:
Borough                        Manhattan
Neighborhood                     Midtown
ID              49d91c12f964a520015e1fe3
Name               The Kati Roll Company
Likes                                832
Rating                               8.8
Tips                                 258
Name: 42, dtype: object
In [29]:
# Restaurants with maximum Rating
indian_rest_stats_ny.iloc[indian_rest_stats_ny['Rating'].idxmax()]
Out[29]:
Borough                        Manhattan
Neighborhood                     Tribeca
ID              4bbb9dbded7776b0e1ad3e51
Name                    Tamarind TriBeCa
Likes                                581
Rating                                 9
Tips                                 145
Name: 45, dtype: object
In [30]:
# Restaurants with maximum Tips
indian_rest_stats_ny.iloc[indian_rest_stats_ny['Tips'].idxmax()]
Out[30]:
Borough                        Manhattan
Neighborhood                     Midtown
ID              49d91c12f964a520015e1fe3
Name               The Kati Roll Company
Likes                                832
Rating                               8.8
Tips                                 258
Name: 42, dtype: object
In [31]:
ny_neighborhood_stats=indian_rest_stats_ny.groupby('Neighborhood',as_index=False).mean()[['Neighborhood','Rating']]
ny_neighborhood_stats.columns=['Neighborhood','Average Rating']
In [32]:
ny_neighborhood_stats.sort_values(['Average Rating'],ascending=False).head(10)
Out[32]:
Neighborhood Average Rating
70 Tribeca 9.00
47 Murray Hill 8.80
44 Midtown 8.80
76 West Village 8.75
50 North Side 8.70
10 Chelsea 8.70
63 South Side 8.70
25 Fort Greene 8.60
79 Yorkville 8.50
62 Roosevelt Island 8.40
In [33]:
ny_borough_stats=indian_rest_stats_ny.groupby('Borough',as_index=False).mean()[['Borough','Rating']]
ny_borough_stats.columns=['Borough','Average Rating']
In [34]:
ny_borough_stats.sort_values(['Average Rating'],ascending=False).head()
Out[34]:
Borough Average Rating
1 Brooklyn 5.968966
0 Bronx 5.683333
2 Manhattan 4.300000
3 Queens 0.000000
4 Staten Island 0.000000
In [35]:
plt.figure(figsize=(9,5), dpi = 100)
# title
plt.title('Average rating of Indian Restaurant in each  NYC Borough')
#On x-axis
plt.xlabel('Borough', fontsize = 15)
#On y-axis
plt.ylabel('Average Rating', fontsize=15)
#giving a bar plot
indian_rest_stats_ny.groupby('Borough').mean()['Rating'].plot(kind='bar')
#legend
plt.legend()
#displays the plot
plt.show()

Brooklyn has the highest average rating for Indian Restaurants.

All the neighborhoods with average rating greater or equal 8.0 to be visualized on map
In [36]:
ny_neighborhood_stats=ny_neighborhood_stats[ny_neighborhood_stats['Average Rating']>=8.0]
In [37]:
ny_neighborhood_stats 
Out[37]:
Neighborhood Average Rating
9 Central Harlem 8.10
10 Chelsea 8.70
13 Clinton Hill 8.35
17 East Flatbush 8.30
25 Fort Greene 8.60
44 Midtown 8.80
47 Murray Hill 8.80
50 North Side 8.70
51 Ocean Hill 8.25
62 Roosevelt Island 8.40
63 South Side 8.70
70 Tribeca 9.00
74 Upper West Side 8.20
76 West Village 8.75
77 Woodlawn 8.00
79 Yorkville 8.50
In [38]:
ny_neighborhood_stats=pd.merge(ny_neighborhood_stats,new_york_data, on='Neighborhood')
In [46]:
ny_neighborhood_stats=ny_neighborhood_stats[['Borough','Neighborhood','Latitude','Longitude','Average Rating']]
In [50]:
ny_neighborhood_stats.sort_values(['Average Rating'],ascending=False).head(10)
Out[50]:
Borough Neighborhood Latitude Longitude Average Rating
13 Manhattan Tribeca 40.721522 -74.010683 9.00
6 Manhattan Midtown 40.754691 -73.981669 8.80
7 Manhattan Murray Hill 40.748303 -73.978332 8.80
8 Queens Murray Hill 40.764126 -73.812763 8.80
15 Manhattan West Village 40.734434 -74.006180 8.75
9 Brooklyn North Side 40.714823 -73.958809 8.70
12 Brooklyn South Side 40.710861 -73.958001 8.70
2 Staten Island Chelsea 40.594726 -74.189560 8.70
1 Manhattan Chelsea 40.744035 -74.003116 8.70
5 Brooklyn Fort Greene 40.688527 -73.972906 8.60
In [41]:
# create map and display it
ny_map = folium.Map(location=(40.693943, -73.985880), zoom_start=12)
In [42]:
# instantiate a feature group for the incidents in the dataframe
incidents = folium.map.FeatureGroup()

# loop through the 100 crimes and add each to the incidents feature group
for lat, lng, in ny_neighborhood_stats[['Latitude','Longitude']].values:
    incidents.add_child(
        folium.CircleMarker(
            [lat, lng],
            radius=10, # define how big you want the circle markers to be
            color='yellow',
            fill=True,
            fill_color='blue',
            fill_opacity=0.6
        )
    )
In [43]:
ny_neighborhood_stats['Label']=ny_neighborhood_stats['Neighborhood']+', '+ny_neighborhood_stats['Borough']+'('+ny_neighborhood_stats['Average Rating'].map(str)+')'
Best neighbourhoods in New York that has highest average rating for Indian Restaurants.
In [44]:
# add pop-up text to each marker on the map
for lat, lng, label in ny_neighborhood_stats[['Latitude','Longitude','Label']].values:
    folium.Marker([lat, lng], popup=label).add_to(ny_map)        
# add incidents to map
ny_map.add_child(incidents)
Out[44]:

Findings

  1. Murray Hill, Tribeca, Midtown in Manhattan are some of the best neighborhoods for Indian cuisine.
  2. Bronx has the lowest rated Indian Resturants in NYC.
  3. Manhattan is the best place to stay if you prefer Indian Cuisine.
Recommendation

Midtown or Tribeca in Manhattan would be the best choice to start a restaurant given that

  1. it is the third most populous urban area in New York City (NYC).
  2. it has a population density of 27,826 people per square km, highest of any borough in the United States.
  3. it has some of the top rated Indian restaurants located in that area
  4. It has the second highest Asian ethnic minority population in NYC.