In [181]:
import sys
import os
import pandas as pd
import numpy as np
import seaborn as sns
from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer
from sklearn.decomposition import PCA, TruncatedSVD
from sklearn.pipeline import make_pipeline
from sklearn.neighbors import NearestNeighbors
from sklearn.preprocessing import Normalizer, StandardScaler
from sklearn.externals import joblib
import folium
from folium import plugins
import matplotlib.pyplot as plt
home_folder = os.environ["home_folder"]
sys.path.append(os.path.join(home_folder, "airbnb_app/airbnb/web_app/flaskexample/"))
import airbnb_pipeline
#sql stuff:
from sqlalchemy import create_engine
from sqlalchemy_utils import database_exists, create_database
import psycopg2
%matplotlib inline
%config InlineBackend.figure_format = 'retina'
In [68]:
listings.head()
Out[68]:
id
neighborhood_overview
price
diff
listing_url
name
0
685006
The apartment is right across the street from ...
75.0
3.206529
https://www.airbnb.com/rooms/685006
Best Studio on Prospect Park
1
9461238
Prime Williamsburg, the hot South side: Steps ...
117.0
57.554158
https://www.airbnb.com/rooms/9461238
1 bedrms Williamsburg 1st Stop L
2
4873690
Long Island City is the ultimate, in my mind, ...
89.0
2.726522
https://www.airbnb.com/rooms/4873690
Private room, 10min to Times Square
3
12738047
None
80.0
19.614082
https://www.airbnb.com/rooms/12738047
clean and tidy separated livingroom
4
15359479
None
200.0
9.892523
https://www.airbnb.com/rooms/15359479
Awesome One Bedroom Gramercy Park
In [63]:
train.head()
Out[63]:
id
neighborhood_overview
neighbourhood_cleansed
city
latitude
longitude
0
685006.0
The apartment is right across the street from ...
Prospect-Lefferts Gardens
Brooklyn
40.661408
-73.961750
1
9461238.0
Prime Williamsburg, the hot South side: Steps ...
Williamsburg
Brooklyn
40.716320
-73.957255
2
4873690.0
Long Island City is the ultimate, in my mind, ...
Long Island City
Queens
40.742824
-73.949939
3
14179829.0
Located on a beautiful, quiet tree lined stree...
Sunnyside
Queens
40.741264
-73.925798
4
7364064.0
This spacious three bedroom is located in the ...
Stuyvesant Town
New York
40.733109
-73.979277
In [75]:
train = pd.read_sql_query("SELECT * FROM location_descriptions", con)
In [77]:
train.columns
Out[77]:
Index(['id', 'neighborhood_overview', 'neighbourhood_cleansed', 'city',
'latitude', 'longitude'],
dtype='object')
In [78]:
train = pd.read_sql_query("""
SELECT id, neighborhood_overview, neighbourhood_cleansed, latitude, longitude,
price, diff, listing_url, name FROM listings_price
""", con)
nbd_counts = train["neighbourhood_cleansed"].value_counts()
descp = train[["id", "neighborhood_overview"]]
descp = descp.drop_duplicates()
In [87]:
print("loading models")
model = joblib.load(os.path.join(home_folder, 'airbnb_app/Data/tf_idf_model.pkl'))
knn = NearestNeighbors(500, metric = "cosine", algorithm = "brute")
X = descp["neighborhood_overview"].dropna()
#somewhat slow - could save the projections first here:
X_proj = model.transform(X)
#fast since there's no real fittting going on here
#should check how fast predicting is - should be fine for a few values.
knn.fit(X_proj)
loading models
Out[87]:
NearestNeighbors(algorithm='brute', leaf_size=30, metric='cosine',
metric_params=None, n_jobs=1, n_neighbors=500, p=2, radius=1.0)
In [88]:
descp = "jamaican cusine culture gritty"
In [89]:
nbd_score = airbnb_pipeline.get_nbds(descp, knn, model, train, nbd_counts)
In [98]:
def get_colors(n):
"""
color scales based on the new matplotlib scales with slight modifications
"""
scales = [["#f2eff1", "#f2eff1", "#451077", "#721F81", "#9F2F7F", "#CD4071",
"#F1605D", "#FD9567", "#FEC98D", "#FCFDBF"],
["#f2eff1", "#f2eff1", "#3E4A89", "#31688E", "#26828E", "#1F9E89", "#35B779",
"#6DCD59", "#B4DE2C", "#FDE725"],
["#f2eff1", "#f2eff1", "#4B0C6B", "#781C6D", "#A52C60", "#CF4446",
"#ED6925", "#FB9A06", "#F7D03C", "#FCFFA4"]]
return(scales[n-1])
def return_color_scale(n):
df = pd.Series(get_colors(n))
df.index = np.power(df.index/10, 1/1.75)
return df.to_dict()
def locations_of_best_match(new_descp, knn, model, train):
neighbors = knn.kneighbors(model.transform([new_descp]))
closest_listings = neighbors[1][0]
results = train.iloc[closest_listings]
return results
def get_heat_map(descp, knn, model, train):
map_osm = folium.Map(tiles='cartodbdark_matter',
location = [40.7831, -73.970], zoom_start=13)
results = locations_of_best_match(descp, knn, model, train)
temp = results[["latitude", "longitude"]].values.tolist()
map_osm.add_children(plugins.HeatMap(temp, min_opacity = 0.45,
radius = 30, blur = 30,
gradient = return_color_scale(1),
name = descp))
for i in range(10):
folium.Marker([results.iloc[i].latitude, results.iloc[i].longitude],
popup=results.iloc[i].neighborhood_overview).add_to(map_osm)
return map_osm
In [99]:
results = locations_of_best_match(descp, knn, model, train)
In [100]:
results = locations_of_best_match(descp, knn, model, train)
In [ ]:
In [101]:
results
Out[101]:
id
neighborhood_overview
neighbourhood_cleansed
latitude
longitude
price
diff
listing_url
name
22205
1217046
The apartment is in the heart of Williamsburg,...
Williamsburg
40.713168
-73.948511
250.0
-47.514673
https://www.airbnb.com/rooms/1217046
Sunny Williamsburg Apt w/ Deck
10736
6437014
Park Slope is considered one of New York City'...
South Slope
40.666316
-73.990132
120.0
17.797299
https://www.airbnb.com/rooms/6437014
Family-Friendly Park Slope Apt 1 BD
11561
15287313
None
Upper East Side
40.770456
-73.952237
133.0
31.645662
https://www.airbnb.com/rooms/15287313
Cozy and cool 1BR in perfect UES
11558
15025178
My neighborhood is up and coming, funky, diver...
Bushwick
40.686089
-73.915714
65.0
4.063596
https://www.airbnb.com/rooms/15025178
Large spacious room!
17904
9512844
Very safe neighborhood - quiet and clean. Grea...
East Harlem
40.792248
-73.944230
345.0
-66.895721
https://www.airbnb.com/rooms/9512844
Decorative 3BR * Sleep 8 *C. Park
14641
11211612
None
Williamsburg
40.714995
-73.950001
50.0
38.514264
https://www.airbnb.com/rooms/11211612
Private Room in Williamsburg BK
19238
3463475
The neighborhood is a nightlife hub on weekend...
Lower East Side
40.718118
-73.986186
126.0
62.308755
https://www.airbnb.com/rooms/3463475
Enjoy Local Life in the Best NYC Neighborhood
22036
15513170
None
Washington Heights
40.837788
-73.942184
55.0
23.273250
https://www.airbnb.com/rooms/15513170
Uptown Bedroom
16051
13961073
Hell's Kitchen is perfectly located for you to...
Civic Center
40.712502
-74.005241
135.0
-0.567293
https://www.airbnb.com/rooms/13961073
Queen of the Castle
11794
1523556
The neighborhood is unique as its right betwee...
Williamsburg
40.710411
-73.938474
178.0
-115.258575
https://www.airbnb.com/rooms/1523556
Simply brooklyn. Bedroom with office off L train.
21917
11844315
The apartment is located in Stuyvestant Height...
Bedford-Stuyvesant
40.682822
-73.936022
100.0
12.230483
https://www.airbnb.com/rooms/11844315
Large, Sunny Brooklyn Apartment
11938
9387436
None
Bedford-Stuyvesant
40.689254
-73.944615
130.0
-29.633136
https://www.airbnb.com/rooms/9387436
Rhonda's bed and breakfast
11939
6897066
The apartment is located right in front of a n...
SoHo
40.726938
-74.003426
235.0
-14.357383
https://www.airbnb.com/rooms/6897066
Fantastic 1 Bedroom in Soho
18140
4121110
Lovely side street on the Upper West Side of M...
Upper West Side
40.791454
-73.977091
195.0
-30.587399
https://www.airbnb.com/rooms/4121110
Upper West Side studio with private terrace
6129
3627589
Quiet, tree-lined, and friendly people. Very s...
Bedford-Stuyvesant
40.685995
-73.951821
36.0
-0.000017
https://www.airbnb.com/rooms/3627589
Cozy Single private room.
21831
2410819
None
East Village
40.729161
-73.980221
125.0
-3.214317
https://www.airbnb.com/rooms/2410819
In the heart of Alphabet City
12268
12794405
Bed-Stuy is a gentrifying area. There is a mix...
Bedford-Stuyvesant
40.686597
-73.918777
65.0
-16.245291
https://www.airbnb.com/rooms/12794405
Private room, bathroom, and balcony
11419
15550805
None
Harlem
40.811248
-73.942173
150.0
-73.736964
https://www.airbnb.com/rooms/15550805
Private Urban Harlem Apartment in Manhattan
19072
8716711
Metropolitan museum of Art and Central Park is...
Upper East Side
40.776985
-73.958402
550.0
-283.731017
https://www.airbnb.com/rooms/8716711
2 bedroom family apt close to park!
21395
4531990
The apartment is located on the outskirts of B...
Bedford-Stuyvesant
40.681571
-73.920235
75.0
-31.160984
https://www.airbnb.com/rooms/4531990
Charming and Clean Brooklyn Apt.
12239
8993422
None
Columbia St
40.689198
-73.999710
175.0
-21.490860
https://www.airbnb.com/rooms/8993422
Huge duplex apartment in Brooklyn
8044
13467433
None
Financial District
40.707063
-74.004419
99.0
9.705000
https://www.airbnb.com/rooms/13467433
This is NYC-Amazing Bedroom at Financial District
14900
10366328
There are plenty of bars and restaurants so yo...
Gramercy
40.733017
-73.981547
90.0
35.333799
https://www.airbnb.com/rooms/10366328
Huge Private bd/b - East Village
11559
13452316
None
Fort Greene
40.687174
-73.978494
60.0
27.778626
https://www.airbnb.com/rooms/13452316
Spacious, light filled room in a luxury building.
18139
7660047
Within the Bronx you can visit the New York Bo...
Morris Heights
40.849490
-73.914996
40.0
7.990105
https://www.airbnb.com/rooms/7660047
Big Room in the Heart of NYC
13399
4533347
Bars, Music, Theatre, Nightlife, Parks, Commun...
East Village
40.729071
-73.985618
200.0
-101.313908
https://www.airbnb.com/rooms/4533347
Beautiful Oasis in Prime Location!
10394
10310103
None
Williamsburg
40.714393
-73.944368
110.0
10.082233
https://www.airbnb.com/rooms/10310103
Large Sunny Lofted Cabin House Room
9181
8612715
Astoria, is one of the safest and trendiest ne...
Astoria
40.762577
-73.921406
70.0
-6.738967
https://www.airbnb.com/rooms/8612715
NYC-Room,NoHiddenFees+FreeBreakfast
1521
7729804
Northern Crown Heights is an very diverse neig...
Crown Heights
40.675171
-73.944214
50.0
20.892739
https://www.airbnb.com/rooms/7729804
Spacious Pre-War in Crown Heights
20233
14601273
Lots of restaurants and shops and very conveni...
Hell's Kitchen
40.766873
-73.982858
280.0
-24.037891
https://www.airbnb.com/rooms/14601273
Stunning NYC home
...
...
...
...
...
...
...
...
...
...
10311
9393610
The Williamsburg area is amazing, and have end...
Williamsburg
40.711603
-73.952097
79.0
41.509674
https://www.airbnb.com/rooms/9393610
Big room in Williamsburg Penthouse
8795
10843988
None
East Harlem
40.798458
-73.942123
201.0
33.443737
https://www.airbnb.com/rooms/10843988
Amazing HUGE NewlyRenovated 2BDRM!!
13004
1518302
None
Murray Hill
40.746451
-73.978924
225.0
-34.282601
https://www.airbnb.com/rooms/1518302
Central Manhattan 1 bedroom
12790
9515435
Bed-Stuy is located in central Brooklyn and nu...
Bedford-Stuyvesant
40.686536
-73.928164
150.0
26.495168
https://www.airbnb.com/rooms/9515435
Charming two-floor brownstone in Bed Stuy
16459
8978525
Around the corner from Franklin avenue with ma...
Crown Heights
40.674457
-73.958762
45.0
2.196993
https://www.airbnb.com/rooms/8978525
Crown Heights Room
6354
3644032
Park Slope is a popular and historic neighborh...
South Slope
40.664918
-73.985990
140.0
-13.042520
https://www.airbnb.com/rooms/3644032
Light-Filled Haven in Park Slope
10173
6249333
Little Russia by the Sea- this unique Eastern ...
Brighton Beach
40.577282
-73.963968
70.0
-26.565906
https://www.airbnb.com/rooms/6249333
Summer Bungalow by the Beach
17560
12774885
Situated close to the park, hospital library ...
Wakefield
40.888714
-73.861754
40.0
27.786861
https://www.airbnb.com/rooms/12774885
Spacious, cozy bedroom in a private
7735
12009678
After all the information about the apartment,...
Hell's Kitchen
40.765825
-73.987447
250.0
-47.985757
https://www.airbnb.com/rooms/12009678
Ground floor studio with garden NY
15211
13044815
None
Financial District
40.708247
-74.014028
90.0
40.385426
https://www.airbnb.com/rooms/13044815
Private room available!
22387
14332710
None
Upper West Side
40.769758
-73.984214
190.0
17.667582
https://www.airbnb.com/rooms/14332710
Spacious Apartment in Manhattan - great views!
9204
16202884
None
Midtown
40.761345
-73.966778
235.0
-57.207755
https://www.airbnb.com/rooms/16202884
Stylish Studio Apartment close to Central Park
11324
7554629
None
Gramercy
40.738910
-73.986601
185.0
-58.817225
https://www.airbnb.com/rooms/7554629
Beautiful Room - Gramercy
11325
10215758
Williamsburg is the epicenter of fashionable B...
Greenpoint
40.720022
-73.951860
220.0
-35.354517
https://www.airbnb.com/rooms/10215758
Modern designer Williamsburg
15701
11601634
The neighborhood is absolutely fabulous with t...
Williamsburg
40.712443
-73.955704
250.0
-17.634723
https://www.airbnb.com/rooms/11601634
Two-Bedroom Duplex in Williamsburg!
16590
6355664
Great neighborhood, Restaurants, museum, Prosp...
Prospect Heights
40.672898
-73.963448
149.0
-0.349656
https://www.airbnb.com/rooms/6355664
Spacious 1 bedroom apartment.
16514
14483355
None
Flatbush
40.654669
-73.957597
115.0
-28.984912
https://www.airbnb.com/rooms/14483355
Spacious Apartment near Prospect Park
22092
14935831
None
Crown Heights
40.671234
-73.931664
225.0
35.335242
https://www.airbnb.com/rooms/14935831
Bright 3BR, 2 FULL BATH (15 MINS to MANHATTAN!)
18529
16180645
Astoria is a very diverse neighborhood with a ...
Long Island City
40.759220
-73.927881
49.0
30.927186
https://www.airbnb.com/rooms/16180645
Private room 15 minutes to Midtown Manhattan.
7710
15957209
None
East Village
40.723967
-73.984528
150.0
-29.386928
https://www.airbnb.com/rooms/15957209
Cozy private bedroom in East Village, New York
15400
12914312
None
Bushwick
40.692904
-73.914782
55.0
-15.851853
https://www.airbnb.com/rooms/12914312
Private room in Trendy Bushwick
16520
6520814
None
Crown Heights
40.668777
-73.955557
37.0
26.795251
https://www.airbnb.com/rooms/6520814
Beautiful, Spacious, Great Location
6497
5346488
This neighborhood has everything you could nee...
Bedford-Stuyvesant
40.693996
-73.934723
50.0
-17.740759
https://www.airbnb.com/rooms/5346488
Huge Sunny Room With En Suite
4094
16103920
A tan sólo unos metros se encuentran casi toda...
Chelsea
40.739923
-74.002209
180.0
42.761926
https://www.airbnb.com/rooms/16103920
Nice Apartment MeatPacking
2313
6673748
Your in Soho Little Italy.. One of hte greates...
Nolita
40.721481
-73.994354
150.0
59.671335
https://www.airbnb.com/rooms/6673748
Mott St Soho Studio - Sleeps 4
18775
7265918
The West Village ! Famous for it's Jazz clubs,...
West Village
40.730547
-74.005194
109.0
86.440080
https://www.airbnb.com/rooms/7265918
West Village. Cultural Center.
5351
7579241
This location is close to everything in the ci...
Chelsea
40.747580
-73.998566
325.0
-120.499758
https://www.airbnb.com/rooms/7579241
A True Gem A-List InteriorDesigner
21137
5030058
None
West Village
40.737808
-74.000594
250.0
-27.041083
https://www.airbnb.com/rooms/5030058
Chic & Central, West Village NYC
21138
704669
None
Fort Greene
40.691626
-73.977091
149.0
7.783598
https://www.airbnb.com/rooms/704669
Sunny Loft Studio, Fort Greene
10029
13066912
Waters edge condo, close to everything. Great...
Upper West Side
40.774328
-73.988723
299.0
-145.977312
https://www.airbnb.com/rooms/13066912
Private Master Bdrm in Luxury Condo
500 rows × 9 columns
In [182]:
descp
Out[182]:
'jamaican cusine culture gritty'
In [183]:
map_osm = folium.Map(tiles='cartodbdark_matter',
location = [40.7831, -73.970], zoom_start=13)
results = locations_of_best_match(descp, knn, model, train)
temp = results[["latitude", "longitude"]].values.tolist()
map_osm.add_children(plugins.HeatMap(temp, min_opacity = 0.45,
radius = 30, blur = 30,
gradient = return_color_scale(1),
name = descp))
Out[183]:
In [121]:
html="""
<h1> This is a big popup</h1><br>
With a few lines of code...
<p>
<code>
from numpy import *<br>
exp(-2*pi)
</code>
</p>
"""
iframe = folium.element.IFrame(html=html, width=500, height=300)
popup = folium.Popup(iframe, max_width=2650)
In [155]:
train
Out[155]:
id
neighborhood_overview
neighbourhood_cleansed
latitude
longitude
price
diff
listing_url
name
0
685006
The apartment is right across the street from ...
Prospect-Lefferts Gardens
40.661408
-73.961750
75.0
3.206529
https://www.airbnb.com/rooms/685006
Best Studio on Prospect Park
1
9461238
Prime Williamsburg, the hot South side: Steps ...
Williamsburg
40.716320
-73.957255
117.0
57.554158
https://www.airbnb.com/rooms/9461238
1 bedrms Williamsburg 1st Stop L
2
4873690
Long Island City is the ultimate, in my mind, ...
Long Island City
40.742824
-73.949939
89.0
2.726522
https://www.airbnb.com/rooms/4873690
Private room, 10min to Times Square
3
12738047
None
Upper West Side
40.799973
-73.965293
80.0
19.614082
https://www.airbnb.com/rooms/12738047
clean and tidy separated livingroom
4
15359479
None
Gramercy
40.735916
-73.986296
200.0
9.892523
https://www.airbnb.com/rooms/15359479
Awesome One Bedroom Gramercy Park
5
14179829
Located on a beautiful, quiet tree lined stree...
Sunnyside
40.741264
-73.925798
63.0
-26.414698
https://www.airbnb.com/rooms/14179829
HUGE zen room, queen bed in beautiful Sunnyside
6
810483
None
East Village
40.729934
-73.979829
119.0
-9.921633
https://www.airbnb.com/rooms/810483
Beautiful, central,sunny, quiet shared apt
7
9854420
None
SoHo
40.727673
-74.003439
200.0
12.590218
https://www.airbnb.com/rooms/9854420
Beautiful one bedroom in Soho
8
4349358
The apartment is located in a beautiful, safe,...
Upper West Side
40.774744
-73.978863
125.0
-2.453585
https://www.airbnb.com/rooms/4349358
Spacious UWS Apt. by Central Park
9
9330135
None
Brighton Beach
40.578082
-73.962530
85.0
46.160573
https://www.airbnb.com/rooms/9330135
Brand new 1 BR apt Steps from train
10
14310864
None
Prospect-Lefferts Gardens
40.661336
-73.961184
80.0
-32.747790
https://www.airbnb.com/rooms/14310864
Spacious Studio Near Prospect Park!
11
1465807
None
Inwood
40.859360
-73.931348
79.0
56.153945
https://www.airbnb.com/rooms/1465807
Park Views! Upper Manhattan 1BR
12
11165126
Architecture, art, and fine dining meets a thr...
Chelsea
40.738694
-73.992643
245.0
-35.655858
https://www.airbnb.com/rooms/11165126
The Best Of UNION SQUARE & CHELSEA
13
16014791
I love the convenient of walking distance to e...
Hell's Kitchen
40.755364
-73.999498
110.0
96.863576
https://www.airbnb.com/rooms/16014791
Nice clean style apt. Central midtwn near Javits
14
16145655
None
Sunnyside
40.745354
-73.919852
150.0
-2.901886
https://www.airbnb.com/rooms/16145655
Spacious 1-bd, sleeps 4, 20 min to Times Square
15
7344066
None
West Village
40.732223
-74.002872
250.0
-57.748208
https://www.airbnb.com/rooms/7344066
Gorgeous West Village 1-bdm apt
16
9461187
None
Greenpoint
40.733913
-73.956788
143.0
12.463699
https://www.airbnb.com/rooms/9461187
Apartment 20 minutes from Manhattan
17
15752636
None
Bushwick
40.700531
-73.921549
40.0
-3.549791
https://www.airbnb.com/rooms/15752636
Spacious Private Room in Brooklyn
18
1727923
Williamsburg is the most dynamic neighborhood ...
Williamsburg
40.713157
-73.956484
98.0
52.209761
https://www.airbnb.com/rooms/1727923
Large private 1BR with backyard - Williamsburg
19
11296173
None
Upper East Side
40.776874
-73.951536
400.0
-172.683828
https://www.airbnb.com/rooms/11296173
Lovely NYC Apartment July 16-30
20
7364008
None
Flatbush
40.653488
-73.955275
99.0
23.746232
https://www.airbnb.com/rooms/7364008
Bohéme 1BR steps from Prospect Park
21
15097255
None
Financial District
40.708772
-74.014632
190.0
-45.019327
https://www.airbnb.com/rooms/15097255
Luxury 1 Br in Luxury Doorman Building
22
3562906
This is centrally located in midtown. Times Sq...
Hell's Kitchen
40.766326
-73.990984
100.0
17.064227
https://www.airbnb.com/rooms/3562906
HighRise Studio-Walk 2 Times Square
23
8699290
Around the Corner on 111th (btw 2nd & 3rd) the...
East Harlem
40.792881
-73.939266
60.0
4.780300
https://www.airbnb.com/rooms/8699290
Private Room Great Area
24
1072481
None
Chelsea
40.745734
-73.997124
80.0
49.715260
https://www.airbnb.com/rooms/1072481
Bedroom for two in Chelsea
25
3431816
The apartment is located in the heart of Crown...
Crown Heights
40.671829
-73.954914
110.0
29.714071
https://www.airbnb.com/rooms/3431816
APT IN PROSPECT/CROWN HEIGHTS
26
3038614
My neighborhood is great because you can walk ...
Bedford-Stuyvesant
40.685964
-73.958375
100.0
-19.642879
https://www.airbnb.com/rooms/3038614
Quiet*Spacious*Private Bath*Sunny!
27
9198992
None
East Village
40.724849
-73.978863
149.0
24.511245
https://www.airbnb.com/rooms/9198992
Modern NY apt in the East Village!
28
528251
None
Prospect-Lefferts Gardens
40.659221
-73.960151
130.0
19.324665
https://www.airbnb.com/rooms/528251
Spacious, Well-Lit Comfortable Apt!
29
16014657
None
Long Island City
40.746444
-73.944792
67.0
-7.896579
https://www.airbnb.com/rooms/16014657
Beautiful private bedroom - LIC
...
...
...
...
...
...
...
...
...
...
39631
12710376
None
Jackson Heights
40.748394
-73.888180
70.0
6.074273
https://www.airbnb.com/rooms/12710376
Private Bedroom #5
39632
12713863
None
Jackson Heights
40.747756
-73.888266
55.0
12.208581
https://www.airbnb.com/rooms/12713863
Private Bedroom #2
39633
12713927
None
Jackson Heights
40.747751
-73.887773
70.0
0.965539
https://www.airbnb.com/rooms/12713927
Private room #3
39634
12294124
None
Jackson Heights
40.748384
-73.887672
140.0
6.715222
https://www.airbnb.com/rooms/12294124
Friendly and Inviting Home
39635
12713763
None
Jackson Heights
40.747726
-73.886446
50.0
-8.705547
https://www.airbnb.com/rooms/12713763
Private Bedroom #1
39636
12713995
None
Jackson Heights
40.748589
-73.886280
70.0
7.097705
https://www.airbnb.com/rooms/12713995
Private Queen Bed #4
39637
14155795
It's the East Village in NYC. Surrounded by gr...
East Village
40.730580
-73.990021
85.0
17.634572
https://www.airbnb.com/rooms/14155795
Room for rent. Quiet, safe.
39638
11272265
Our place is perfectly located in Midtown Manh...
Midtown
40.757410
-73.981089
475.0
-161.416054
https://www.airbnb.com/rooms/11272265
Spacious 3 BR APT in Midtown(5/6AVE
39639
6029332
It's Williamsburg, literally the hippest place...
Williamsburg
40.711923
-73.941605
110.0
-16.992103
https://www.airbnb.com/rooms/6029332
Very private & large room Wburg BK
39640
14371812
The neighborhood is safe and located in a conv...
Astoria
40.756167
-73.918264
46.0
-11.412174
https://www.airbnb.com/rooms/14371812
Comfortable One Private Bedroom near Manhattan
39641
14549056
The neighborhood is a vibrant, multicultural c...
Astoria
40.755894
-73.919049
130.0
16.284377
https://www.airbnb.com/rooms/14549056
LIC/Astoria Two Bed Apt 10 minutes from Manhattan
39642
13926463
The neighborhood is a vibrant, multicultural c...
Long Island City
40.753819
-73.919683
70.0
-28.499690
https://www.airbnb.com/rooms/13926463
Lovely Private room near Manhattan
39643
11927624
The neighborhood is the best neighborhood in N...
Vinegar Hill
40.703284
-73.983138
170.0
61.387627
https://www.airbnb.com/rooms/11927624
Light filled modern APT in DUMBO
39644
15073292
Grocery Stores, Bars, Italian Restaurants, CVS...
Shore Acres
40.607567
-74.067312
100.0
42.895464
https://www.airbnb.com/rooms/15073292
Private Studio; Near All NYC
39645
11617806
None
Williamsburg
40.712526
-73.952169
45.0
52.699610
https://www.airbnb.com/rooms/11617806
Bedroom in Williamsburg, BK, NYC
39646
12189731
None
Williamsburg
40.714389
-73.951972
60.0
47.164332
https://www.airbnb.com/rooms/12189731
Very bright room in 3BD/2BR
39647
11010126
The apartment is blocks from the water, subway...
Kips Bay
40.740191
-73.980192
125.0
-21.969696
https://www.airbnb.com/rooms/11010126
Gramercy: Convenient Bright Quiet
39648
15708092
From its inception, Harlem has kept a cadence ...
Harlem
40.808280
-73.943411
86.0
28.335475
https://www.airbnb.com/rooms/15708092
Charming 1BR A in townhouse with modern amenities
39649
15675757
From its inception, Harlem has kept a cadence ...
Harlem
40.809712
-73.942302
93.0
14.006962
https://www.airbnb.com/rooms/15675757
Charming 1BR B in townhouse with modern amenities
39650
15859751
rom its inception, Harlem has kept a cadence l...
Harlem
40.808099
-73.942077
245.0
-23.530330
https://www.airbnb.com/rooms/15859751
Charming 2BR in townhouse with modern amenities
39651
14297551
None
East Harlem
40.804861
-73.941231
50.0
23.005905
https://www.airbnb.com/rooms/14297551
Home Away from Home
39652
15072707
Heart of Time Square, middle of Manhattan in t...
Hell's Kitchen
40.759918
-73.989345
140.0
11.027216
https://www.airbnb.com/rooms/15072707
Holiday in Heart of Time Square/NYC
39653
15073845
Heart of Time Square, middle of Manhattan in t...
Hell's Kitchen
40.758939
-73.989247
140.0
18.962897
https://www.airbnb.com/rooms/15073845
Brandnew Luxury flat in Time Square
39654
15073307
Heart of Time Square, middle of Manhattan in t...
Hell's Kitchen
40.758142
-73.989213
280.0
24.922194
https://www.airbnb.com/rooms/15073307
2bdr Flat - Xmass in Time Squre NYC
39655
6422551
Bushwick is now referred to as "the hippest ne...
Williamsburg
40.707102
-73.929437
75.0
4.204960
https://www.airbnb.com/rooms/6422551
cute and clean in trendy Bushwick
39656
9118958
Quiet , safe , near to all
Richmond Hill
40.694172
-73.830716
65.0
-17.202634
https://www.airbnb.com/rooms/9118958
Big room in private house
39657
5309959
Very independent and safe , near to a beautifu...
Richmond Hill
40.695086
-73.832029
50.0
7.516149
https://www.airbnb.com/rooms/5309959
A room in private house, small room
39658
11228502
The place is quiet near to a beautiful park ( ...
Richmond Hill
40.695847
-73.830983
65.0
-7.517350
https://www.airbnb.com/rooms/11228502
A nice room in private house
39659
15859741
Lefferts Gardens (also known as Prospect Leffe...
Prospect-Lefferts Gardens
40.660316
-73.948480
94.0
-44.238787
https://www.airbnb.com/rooms/15859741
Home away from home in heart of BK
39660
14024708
It is a very small, tight-knot community. The ...
New Dorp Beach
40.564636
-74.100005
62.0
16.260990
https://www.airbnb.com/rooms/14024708
Your beach-side bungalow awaits!
39661 rows × 9 columns
In [172]:
results
Out[172]:
id
neighborhood_overview
neighbourhood_cleansed
latitude
longitude
price
diff
listing_url
name
22205
1217046
The apartment is in the heart of Williamsburg,...
Williamsburg
40.713168
-73.948511
250.0
-47.514673
https://www.airbnb.com/rooms/1217046
Sunny Williamsburg Apt w/ Deck
10736
6437014
Park Slope is considered one of New York City'...
South Slope
40.666316
-73.990132
120.0
17.797299
https://www.airbnb.com/rooms/6437014
Family-Friendly Park Slope Apt 1 BD
11561
15287313
None
Upper East Side
40.770456
-73.952237
133.0
31.645662
https://www.airbnb.com/rooms/15287313
Cozy and cool 1BR in perfect UES
11558
15025178
My neighborhood is up and coming, funky, diver...
Bushwick
40.686089
-73.915714
65.0
4.063596
https://www.airbnb.com/rooms/15025178
Large spacious room!
17904
9512844
Very safe neighborhood - quiet and clean. Grea...
East Harlem
40.792248
-73.944230
345.0
-66.895721
https://www.airbnb.com/rooms/9512844
Decorative 3BR * Sleep 8 *C. Park
14641
11211612
None
Williamsburg
40.714995
-73.950001
50.0
38.514264
https://www.airbnb.com/rooms/11211612
Private Room in Williamsburg BK
19238
3463475
The neighborhood is a nightlife hub on weekend...
Lower East Side
40.718118
-73.986186
126.0
62.308755
https://www.airbnb.com/rooms/3463475
Enjoy Local Life in the Best NYC Neighborhood
22036
15513170
None
Washington Heights
40.837788
-73.942184
55.0
23.273250
https://www.airbnb.com/rooms/15513170
Uptown Bedroom
16051
13961073
Hell's Kitchen is perfectly located for you to...
Civic Center
40.712502
-74.005241
135.0
-0.567293
https://www.airbnb.com/rooms/13961073
Queen of the Castle
11794
1523556
The neighborhood is unique as its right betwee...
Williamsburg
40.710411
-73.938474
178.0
-115.258575
https://www.airbnb.com/rooms/1523556
Simply brooklyn. Bedroom with office off L train.
21917
11844315
The apartment is located in Stuyvestant Height...
Bedford-Stuyvesant
40.682822
-73.936022
100.0
12.230483
https://www.airbnb.com/rooms/11844315
Large, Sunny Brooklyn Apartment
11938
9387436
None
Bedford-Stuyvesant
40.689254
-73.944615
130.0
-29.633136
https://www.airbnb.com/rooms/9387436
Rhonda's bed and breakfast
11939
6897066
The apartment is located right in front of a n...
SoHo
40.726938
-74.003426
235.0
-14.357383
https://www.airbnb.com/rooms/6897066
Fantastic 1 Bedroom in Soho
18140
4121110
Lovely side street on the Upper West Side of M...
Upper West Side
40.791454
-73.977091
195.0
-30.587399
https://www.airbnb.com/rooms/4121110
Upper West Side studio with private terrace
6129
3627589
Quiet, tree-lined, and friendly people. Very s...
Bedford-Stuyvesant
40.685995
-73.951821
36.0
-0.000017
https://www.airbnb.com/rooms/3627589
Cozy Single private room.
21831
2410819
None
East Village
40.729161
-73.980221
125.0
-3.214317
https://www.airbnb.com/rooms/2410819
In the heart of Alphabet City
12268
12794405
Bed-Stuy is a gentrifying area. There is a mix...
Bedford-Stuyvesant
40.686597
-73.918777
65.0
-16.245291
https://www.airbnb.com/rooms/12794405
Private room, bathroom, and balcony
11419
15550805
None
Harlem
40.811248
-73.942173
150.0
-73.736964
https://www.airbnb.com/rooms/15550805
Private Urban Harlem Apartment in Manhattan
19072
8716711
Metropolitan museum of Art and Central Park is...
Upper East Side
40.776985
-73.958402
550.0
-283.731017
https://www.airbnb.com/rooms/8716711
2 bedroom family apt close to park!
21395
4531990
The apartment is located on the outskirts of B...
Bedford-Stuyvesant
40.681571
-73.920235
75.0
-31.160984
https://www.airbnb.com/rooms/4531990
Charming and Clean Brooklyn Apt.
12239
8993422
None
Columbia St
40.689198
-73.999710
175.0
-21.490860
https://www.airbnb.com/rooms/8993422
Huge duplex apartment in Brooklyn
8044
13467433
None
Financial District
40.707063
-74.004419
99.0
9.705000
https://www.airbnb.com/rooms/13467433
This is NYC-Amazing Bedroom at Financial District
14900
10366328
There are plenty of bars and restaurants so yo...
Gramercy
40.733017
-73.981547
90.0
35.333799
https://www.airbnb.com/rooms/10366328
Huge Private bd/b - East Village
11559
13452316
None
Fort Greene
40.687174
-73.978494
60.0
27.778626
https://www.airbnb.com/rooms/13452316
Spacious, light filled room in a luxury building.
18139
7660047
Within the Bronx you can visit the New York Bo...
Morris Heights
40.849490
-73.914996
40.0
7.990105
https://www.airbnb.com/rooms/7660047
Big Room in the Heart of NYC
13399
4533347
Bars, Music, Theatre, Nightlife, Parks, Commun...
East Village
40.729071
-73.985618
200.0
-101.313908
https://www.airbnb.com/rooms/4533347
Beautiful Oasis in Prime Location!
10394
10310103
None
Williamsburg
40.714393
-73.944368
110.0
10.082233
https://www.airbnb.com/rooms/10310103
Large Sunny Lofted Cabin House Room
9181
8612715
Astoria, is one of the safest and trendiest ne...
Astoria
40.762577
-73.921406
70.0
-6.738967
https://www.airbnb.com/rooms/8612715
NYC-Room,NoHiddenFees+FreeBreakfast
1521
7729804
Northern Crown Heights is an very diverse neig...
Crown Heights
40.675171
-73.944214
50.0
20.892739
https://www.airbnb.com/rooms/7729804
Spacious Pre-War in Crown Heights
20233
14601273
Lots of restaurants and shops and very conveni...
Hell's Kitchen
40.766873
-73.982858
280.0
-24.037891
https://www.airbnb.com/rooms/14601273
Stunning NYC home
...
...
...
...
...
...
...
...
...
...
10311
9393610
The Williamsburg area is amazing, and have end...
Williamsburg
40.711603
-73.952097
79.0
41.509674
https://www.airbnb.com/rooms/9393610
Big room in Williamsburg Penthouse
8795
10843988
None
East Harlem
40.798458
-73.942123
201.0
33.443737
https://www.airbnb.com/rooms/10843988
Amazing HUGE NewlyRenovated 2BDRM!!
13004
1518302
None
Murray Hill
40.746451
-73.978924
225.0
-34.282601
https://www.airbnb.com/rooms/1518302
Central Manhattan 1 bedroom
12790
9515435
Bed-Stuy is located in central Brooklyn and nu...
Bedford-Stuyvesant
40.686536
-73.928164
150.0
26.495168
https://www.airbnb.com/rooms/9515435
Charming two-floor brownstone in Bed Stuy
16459
8978525
Around the corner from Franklin avenue with ma...
Crown Heights
40.674457
-73.958762
45.0
2.196993
https://www.airbnb.com/rooms/8978525
Crown Heights Room
6354
3644032
Park Slope is a popular and historic neighborh...
South Slope
40.664918
-73.985990
140.0
-13.042520
https://www.airbnb.com/rooms/3644032
Light-Filled Haven in Park Slope
10173
6249333
Little Russia by the Sea- this unique Eastern ...
Brighton Beach
40.577282
-73.963968
70.0
-26.565906
https://www.airbnb.com/rooms/6249333
Summer Bungalow by the Beach
17560
12774885
Situated close to the park, hospital library ...
Wakefield
40.888714
-73.861754
40.0
27.786861
https://www.airbnb.com/rooms/12774885
Spacious, cozy bedroom in a private
7735
12009678
After all the information about the apartment,...
Hell's Kitchen
40.765825
-73.987447
250.0
-47.985757
https://www.airbnb.com/rooms/12009678
Ground floor studio with garden NY
15211
13044815
None
Financial District
40.708247
-74.014028
90.0
40.385426
https://www.airbnb.com/rooms/13044815
Private room available!
22387
14332710
None
Upper West Side
40.769758
-73.984214
190.0
17.667582
https://www.airbnb.com/rooms/14332710
Spacious Apartment in Manhattan - great views!
9204
16202884
None
Midtown
40.761345
-73.966778
235.0
-57.207755
https://www.airbnb.com/rooms/16202884
Stylish Studio Apartment close to Central Park
11324
7554629
None
Gramercy
40.738910
-73.986601
185.0
-58.817225
https://www.airbnb.com/rooms/7554629
Beautiful Room - Gramercy
11325
10215758
Williamsburg is the epicenter of fashionable B...
Greenpoint
40.720022
-73.951860
220.0
-35.354517
https://www.airbnb.com/rooms/10215758
Modern designer Williamsburg
15701
11601634
The neighborhood is absolutely fabulous with t...
Williamsburg
40.712443
-73.955704
250.0
-17.634723
https://www.airbnb.com/rooms/11601634
Two-Bedroom Duplex in Williamsburg!
16590
6355664
Great neighborhood, Restaurants, museum, Prosp...
Prospect Heights
40.672898
-73.963448
149.0
-0.349656
https://www.airbnb.com/rooms/6355664
Spacious 1 bedroom apartment.
16514
14483355
None
Flatbush
40.654669
-73.957597
115.0
-28.984912
https://www.airbnb.com/rooms/14483355
Spacious Apartment near Prospect Park
22092
14935831
None
Crown Heights
40.671234
-73.931664
225.0
35.335242
https://www.airbnb.com/rooms/14935831
Bright 3BR, 2 FULL BATH (15 MINS to MANHATTAN!)
18529
16180645
Astoria is a very diverse neighborhood with a ...
Long Island City
40.759220
-73.927881
49.0
30.927186
https://www.airbnb.com/rooms/16180645
Private room 15 minutes to Midtown Manhattan.
7710
15957209
None
East Village
40.723967
-73.984528
150.0
-29.386928
https://www.airbnb.com/rooms/15957209
Cozy private bedroom in East Village, New York
15400
12914312
None
Bushwick
40.692904
-73.914782
55.0
-15.851853
https://www.airbnb.com/rooms/12914312
Private room in Trendy Bushwick
16520
6520814
None
Crown Heights
40.668777
-73.955557
37.0
26.795251
https://www.airbnb.com/rooms/6520814
Beautiful, Spacious, Great Location
6497
5346488
This neighborhood has everything you could nee...
Bedford-Stuyvesant
40.693996
-73.934723
50.0
-17.740759
https://www.airbnb.com/rooms/5346488
Huge Sunny Room With En Suite
4094
16103920
A tan sólo unos metros se encuentran casi toda...
Chelsea
40.739923
-74.002209
180.0
42.761926
https://www.airbnb.com/rooms/16103920
Nice Apartment MeatPacking
2313
6673748
Your in Soho Little Italy.. One of hte greates...
Nolita
40.721481
-73.994354
150.0
59.671335
https://www.airbnb.com/rooms/6673748
Mott St Soho Studio - Sleeps 4
18775
7265918
The West Village ! Famous for it's Jazz clubs,...
West Village
40.730547
-74.005194
109.0
86.440080
https://www.airbnb.com/rooms/7265918
West Village. Cultural Center.
5351
7579241
This location is close to everything in the ci...
Chelsea
40.747580
-73.998566
325.0
-120.499758
https://www.airbnb.com/rooms/7579241
A True Gem A-List InteriorDesigner
21137
5030058
None
West Village
40.737808
-74.000594
250.0
-27.041083
https://www.airbnb.com/rooms/5030058
Chic & Central, West Village NYC
21138
704669
None
Fort Greene
40.691626
-73.977091
149.0
7.783598
https://www.airbnb.com/rooms/704669
Sunny Loft Studio, Fort Greene
10029
13066912
Waters edge condo, close to everything. Great...
Upper West Side
40.774328
-73.988723
299.0
-145.977312
https://www.airbnb.com/rooms/13066912
Private Master Bdrm in Luxury Condo
500 rows × 9 columns
In [179]:
for i in range(10):
html = """<h1> <a href = {0} target="_blank"> View on AirBnB </a> </h1>
<p> {1} </p>
""".format(results.iloc[i].listing_url ,results.iloc[i]["name"])
iframe = folium.element.IFrame(html=html, width=500, height=300)
popup = folium.Popup(iframe, max_width=2650)
folium.Marker([results.iloc[i].latitude,
results.iloc[i].longitude],
popup=popup).add_to(map_osm)
In [157]:
results.iloc[10].neighborhood_overview
Out[157]:
'The apartment is located in Stuyvestant Heights, a quiet and historic Brooklyn neighborhood, filled with beautiful brownstone buildings. The apartment is only a block away from Saraghina, a delicious pizza place and bakery. There are a ton of other restaurants nearby including Peaches, Georges Andre, Tepache Mexican, and Il Lunatico.'
In [180]:
map_osm
Out[180]:
In [ ]:
Content source: apapiu/airbnb_app
Similar notebooks: