before use this script, you should have the following packages you can install GeoPandas git clone https://github.com/kjordahl/geopandas and then install it with


    python setup.py install
    conda install fiona
    conda install pysal

yxcheng@uw.edu Yuxuan Cheng https://sites.google.com/view/ycheng


In [1]:
import shapely
import geopandas as gpd

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

import matplotlib
import matplotlib.pyplot as plt
import seaborn as sns
#from matplotlib import interactive
#interactive(True)
%matplotlib inline

In [3]:
import pysal
from scipy import ndimage
#p1 = shapely.geometry.Polygon([(0, 0), (1, 0), (1, 1)])
#p2 = shapely.geometry.Polygon([(0, 0), (1, 0), (1, 1), (0, 1)])
#p3 = shapely.geometry.Polygon([(2, 0), (3, 0), (3, 1), (2, 1)])
#g = gpd.GeoSeries([p1,p2,p3])
#g.area
#g.plot()
#matplotlib.pyplot.show()

In [4]:
#road the data
boros = gpd.GeoDataFrame.from_file('project/Output/SelectedBlocks.shp')

In [5]:
#show the first data frame
boros.ix[0]
#boros.blocks


Out[5]:
ALAND10                                                  121128
AWATER10                                                      0
BLOCKCE10                                                  1001
COUNTYFP10                                                  033
FUNCSTAT10                                                    S
GEOID10                                         530330067001001
INTPTLAT10                                          +47.6319178
INTPTLON10                                         -122.3399002
MTFCC10                                                   G5040
NAME10                                               Block 1001
OBJECTID                                                      1
STATEFP10                                                    53
Shape_Area                                           1.4496e-05
Shape_Leng                                             0.027448
TRACTCE10                                                006700
TRACT_10                                                   6700
TRBL                                                     6700.1
UACE10                                                     None
UR10                                                       None
geometry      POLYGON ((-122.3406299995747 47.6324870001751,...
Name: 0, dtype: object

In [6]:
#plot the dataframe
boros.plot()
matplotlib.pyplot.show()



In [7]:
#get the data(future will read antother dataset)
boros['InCount'] = boros['OBJECTID'].mod(255)

In [8]:
#show the range of OBJECCTID
boros['OBJECTID'].max()


Out[8]:
34663

In [9]:
#show the name of the “geometry” column of gpd
boros.geometry.name


Out[9]:
'geometry'

In [10]:
#create the centroid of each block (point data)
boros['centroid_column'] = boros.centroid

In [11]:
#show the data
boros.head()


Out[11]:
ALAND10 AWATER10 BLOCKCE10 COUNTYFP10 FUNCSTAT10 GEOID10 INTPTLAT10 INTPTLON10 MTFCC10 NAME10 ... Shape_Area Shape_Leng TRACTCE10 TRACT_10 TRBL UACE10 UR10 geometry InCount centroid_column
0 121128.0 0.0 1001 033 S 530330067001001 +47.6319178 -122.3399002 G5040 Block 1001 ... 1.449595e-05 0.027448 006700 6700 6700.1001 None None POLYGON ((-122.3406299995747 47.6324870001751,... 1 POINT (-122.3399002366727 47.63191799346607)
1 20412.0 0.0 1009 033 S 530330069001009 +47.6368455 -122.3629779 G5040 Block 1009 ... 2.443019e-06 0.006327 006900 6900 6900.1009 None None POLYGON ((-122.362319999768 47.63593299990816,... 2 POINT (-122.3629779418765 47.63684552155818)
2 16082.0 0.0 5021 033 S 530330116005021 +47.5204486 -122.3920438 G5040 Block 5021 ... 1.920568e-06 0.005893 011600 11600 11600.5021 None None POLYGON ((-122.3917790003005 47.51974199989354... 4 POINT (-122.392043788155 47.52044865187271)
3 2697.0 0.0 5023 033 S 530330116005023 +47.5205365 -122.3899013 G5040 Block 5023 ... 3.220622e-07 0.003135 011600 11600 11600.5023 None None POLYGON ((-122.390215000122 47.52080000012006,... 5 POINT (-122.3899012536813 47.52053650264553)
4 16320.0 0.0 2007 033 S 530330115002007 +47.5272927 -122.3806803 G5040 Block 2007 ... 1.949297e-06 0.006836 011500 11500 11500.2007 None None POLYGON ((-122.3793320000716 47.5276230000016,... 18 POINT (-122.3806803250455 47.52729271292806)

5 rows × 22 columns


In [12]:
#change the name of column
boros.rename(columns={'centroid_column': 'centroid_XY'})


Out[12]:
ALAND10 AWATER10 BLOCKCE10 COUNTYFP10 FUNCSTAT10 GEOID10 INTPTLAT10 INTPTLON10 MTFCC10 NAME10 ... Shape_Area Shape_Leng TRACTCE10 TRACT_10 TRBL UACE10 UR10 geometry InCount centroid_XY
0 121128.0 0.0 1001 033 S 530330067001001 +47.6319178 -122.3399002 G5040 Block 1001 ... 1.449595e-05 0.027448 006700 6700 6700.1001 None None POLYGON ((-122.3406299995747 47.6324870001751,... 1 POINT (-122.3399002366727 47.63191799346607)
1 20412.0 0.0 1009 033 S 530330069001009 +47.6368455 -122.3629779 G5040 Block 1009 ... 2.443019e-06 0.006327 006900 6900 6900.1009 None None POLYGON ((-122.362319999768 47.63593299990816,... 2 POINT (-122.3629779418765 47.63684552155818)
2 16082.0 0.0 5021 033 S 530330116005021 +47.5204486 -122.3920438 G5040 Block 5021 ... 1.920568e-06 0.005893 011600 11600 11600.5021 None None POLYGON ((-122.3917790003005 47.51974199989354... 4 POINT (-122.392043788155 47.52044865187271)
3 2697.0 0.0 5023 033 S 530330116005023 +47.5205365 -122.3899013 G5040 Block 5023 ... 3.220622e-07 0.003135 011600 11600 11600.5023 None None POLYGON ((-122.390215000122 47.52080000012006,... 5 POINT (-122.3899012536813 47.52053650264553)
4 16320.0 0.0 2007 033 S 530330115002007 +47.5272927 -122.3806803 G5040 Block 2007 ... 1.949297e-06 0.006836 011500 11500 11500.2007 None None POLYGON ((-122.3793320000716 47.5276230000016,... 18 POINT (-122.3806803250455 47.52729271292806)
5 41595.0 0.0 2005 033 S 530330121002005 +47.5068656 -122.3787497 G5040 Block 2005 ... 4.966028e-06 0.012906 012100 12100 12100.2005 None None POLYGON ((-122.3760010002458 47.50639300033686... 21 POINT (-122.3787497508842 47.50686558552383)
6 21236.0 0.0 2013 033 S 530330066002013 +47.6348524 -122.3240336 G5040 Block 2013 ... 2.541550e-06 0.011712 006600 6600 6600.2013 None None POLYGON ((-122.324698999659 47.63225600031433,... 32 POINT (-122.3240336290084 47.63485245185199)
7 10454.0 0.0 1014 033 S 530330067001014 +47.6328601 -122.3428443 G5040 Block 1014 ... 1.251077e-06 0.004481 006700 6700 6700.1014 None None POLYGON ((-122.3434029997485 47.63341599984869... 33 POINT (-122.3428443205387 47.63286013116908)
8 304451.0 0.0 6000 033 S 530330032006000 +47.6806102 -122.4069685 G5040 Block 6000 ... 3.646848e-05 0.037713 003200 3200 3200.6000 None None POLYGON ((-122.412540999967 47.67621899970726,... 40 POINT (-122.4069682954432 47.68061033180799)
9 18654.0 0.0 4017 033 S 530330032004017 +47.6690497 -122.3969885 G5040 Block 4017 ... 2.234018e-06 0.007017 003200 3200 3200.4017 None None POLYGON ((-122.3983189997219 47.66862300015151... 43 POINT (-122.3969884679725 47.66904970401041)
10 9559.0 0.0 3018 033 S 530330056003018 +47.6411286 -122.4106250 G5040 Block 3018 ... 1.144232e-06 0.005428 005600 5600 5600.3018 None None POLYGON ((-122.4099819997693 47.6402999998453,... 47 POINT (-122.4106250043156 47.64112864160045)
11 16294.0 0.0 1005 033 S 530330056001005 +47.6513604 -122.4052120 G5040 Block 1005 ... 1.950712e-06 0.005784 005600 5600 5600.1005 None None POLYGON ((-122.4046809999281 47.65044600008298... 49 POINT (-122.405212004047 47.65136038677456)
12 20048.0 0.0 6009 033 S 530330057006009 +47.6550029 -122.3962991 G5040 Block 6009 ... 2.400322e-06 0.006343 005700 5700 5700.6009 None None POLYGON ((-122.3968959997504 47.6540629996079,... 51 POINT (-122.3962991196612 47.65500288731763)
13 20814.0 0.0 1000 033 S 530330058021000 +47.6475223 -122.3826898 G5040 Block 1000 ... 2.491714e-06 0.006412 005802 5802 5802.1000 None None POLYGON ((-122.3820329996231 47.64658199995949... 54 POINT (-122.3826897959563 47.64752230701134)
14 20090.0 0.0 1008 033 S 530330058021008 +47.6456652 -122.3839948 G5040 Block 1008 ... 2.404914e-06 0.006286 005802 5802 5802.1008 None None POLYGON ((-122.3833219997104 47.64475800038156... 55 POINT (-122.383994834054 47.64566518139661)
15 11279.0 0.0 2005 033 S 530330058022005 +47.6479672 -122.3781732 G5040 Block 2005 ... 1.350178e-06 0.004708 005802 5802 5802.2005 None None POLYGON ((-122.3774830002402 47.64747899995604... 57 POINT (-122.3781731510543 47.64796715661811)
16 12276.0 0.0 1006 033 S 530330103001006 +47.5576117 -122.2788441 G5040 Block 1006 ... 1.467131e-06 0.004910 010300 10300 10300.1006 None None POLYGON ((-122.2782099997915 47.55703300007303... 58 POINT (-122.278844092174 47.55761168891294)
17 20795.0 0.0 2006 033 S 530330103002006 +47.5507988 -122.2791225 G5040 Block 2006 ... 2.484869e-06 0.008220 010300 10300 10300.2006 None None POLYGON ((-122.2776659998858 47.55117399968049... 59 POINT (-122.2791225286143 47.55079878419995)
18 14980.0 0.0 4002 033 S 530330111014002 +47.5456436 -122.2820906 G5040 Block 4002 ... 1.789818e-06 0.006426 011101 11101 11101.4002 None None POLYGON ((-122.2808500001273 47.54598599965431... 60 POINT (-122.2820906452474 47.54564364315645)
19 16191.0 0.0 1028 033 S 530330101001028 +47.5614891 -122.2677245 G5040 Block 1028 ... 1.935033e-06 0.007403 010100 10100 10100.1028 None None POLYGON ((-122.2682649998297 47.56294200007341... 61 POINT (-122.2677244787185 47.56148910912029)
20 12312.0 0.0 1002 033 S 530330102001002 +47.5600187 -122.2663051 G5040 Block 1002 ... 1.471448e-06 0.004855 010200 10200 10200.1002 None None POLYGON ((-122.2656810002778 47.56060700031298... 62 POINT (-122.2663050893917 47.5600187491734)
21 8665.0 0.0 4022 033 S 530330102004022 +47.5545057 -122.2688699 G5040 Block 4022 ... 1.035472e-06 0.004457 010200 10200 10200.4022 None None POLYGON ((-122.2681590003375 47.554844999897, ... 63 POINT (-122.268869863857 47.55450566224778)
22 17364.0 0.0 3005 033 S 530330102003005 +47.5507687 -122.2712986 G5040 Block 3005 ... 2.074864e-06 0.007024 010200 10200 10200.3005 None None POLYGON ((-122.2699150003768 47.55113799981899... 64 POINT (-122.2712986222764 47.55076864780011)
23 19972.0 0.0 2010 033 S 530330008002010 +47.7093844 -122.2825157 G5040 Block 2010 ... 2.393646e-06 0.006444 000800 800 800.2010 None None POLYGON ((-122.2814819995945 47.70862000011306... 67 POINT (-122.2825156945703 47.709384400671)
24 13349.0 0.0 1013 033 S 530330039001013 +47.6801478 -122.2844891 G5040 Block 1013 ... 1.598976e-06 0.005117 003900 3900 3900.1013 None None POLYGON ((-122.2839229997465 47.6794130004098,... 70 POINT (-122.2844891159834 47.68014776782884)
25 24214.0 0.0 1018 033 S 530330042001018 +47.6710011 -122.2780715 G5040 Block 1018 ... 2.899933e-06 0.008600 004200 4200 4200.1018 None None POLYGON ((-122.2764870003746 47.67072499995896... 71 POINT (-122.27807146836 47.6710011300076)
26 60414.0 0.0 2030 033 S 530330093002030 +47.5913891 -122.3324696 G5040 Block 2030 ... 7.224543e-06 0.011169 009300 9300 9300.2030 None None POLYGON ((-122.332001000046 47.59031099955314,... 73 POINT (-122.3324695880025 47.5913890728828)
27 15472.0 0.0 1001 033 S 530330030001001 +47.6898864 -122.3666686 G5040 Block 1001 ... 1.853629e-06 0.005557 003000 3000 3000.1001 None None POLYGON ((-122.3660799995922 47.68911199981909... 74 POINT (-122.3666686177212 47.68988643271641)
28 10354.0 0.0 4013 033 S 530330058014013 +47.6553944 -122.3810583 G5040 Block 4013 ... 1.239740e-06 0.006838 005801 5801 5801.4013 None None POLYGON ((-122.3799610002998 47.65511400041095... 75 POINT (-122.3810583383445 47.65539442325716)
29 27761.0 0.0 2002 033 S 530330016002002 +47.6997137 -122.3841645 G5040 Block 2002 ... 3.326525e-06 0.007462 001600 1600 1600.2002 None None POLYGON ((-122.3853000000948 47.69897799973506... 111 POINT (-122.3841644912789 47.69971370265976)
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
6789 20638.0 0.0 2019 033 S 530330048002019 +47.6595999 -122.3557797 G5040 Block 2019 ... 2.471205e-06 0.008798 004800 4800 4800.2019 None None POLYGON ((-122.3560940004376 47.65959700030152... 177 POINT (-122.3557796591995 47.65959989340061)
6790 7689.0 0.0 1004 033 S 530330049001004 +47.6646707 -122.3520908 G5040 Block 1004 ... 9.207729e-07 0.003972 004900 4900 4900.1004 None None POLYGON ((-122.3514700003401 47.6643009995916,... 178 POINT (-122.3520908274748 47.66467069930623)
6791 15511.0 0.0 4017 033 S 530330049004017 +47.6560383 -122.3518530 G5040 Block 4017 ... 1.857145e-06 0.005464 004900 4900 4900.4017 None None POLYGON ((-122.3511130000647 47.65666700008217... 179 POINT (-122.3518530201717 47.65603833052018)
6792 6543.0 0.0 4019 033 S 530330049004019 +47.6560268 -122.3502504 G5040 Block 4019 ... 7.833415e-07 0.003773 004900 4900 4900.4019 None None POLYGON ((-122.349929000323 47.65540100015619,... 180 POINT (-122.3502504274576 47.65602675349704)
6793 22317.0 0.0 3011 033 S 530330049003011 +47.6528853 -122.3518131 G5040 Block 3011 ... 2.671905e-06 0.007227 004900 4900 4900.3011 None None POLYGON ((-122.3512819997644 47.65414099960759... 181 POINT (-122.3518130962969 47.65288535509042)
6794 19844.0 0.0 3010 033 S 530330049003010 +47.6530140 -122.3528726 G5040 Block 3010 ... 2.375809e-06 0.006602 004900 4900 4900.3010 None None POLYGON ((-122.3524050002904 47.65177600026237... 182 POINT (-122.3528726480492 47.65301401467341)
6795 15940.0 0.0 3011 033 S 530330024003011 +47.6839505 -122.2899820 G5040 Block 3011 ... 1.909491e-06 0.005732 002400 2400 2400.3011 None None POLYGON ((-122.2894249998637 47.68304499972714... 183 POINT (-122.2899819999192 47.68395049966599)
6796 15574.0 0.0 1007 033 S 530330024001007 +47.6893081 -122.2869415 G5040 Block 1007 ... 1.865803e-06 0.005644 002400 2400 2400.1007 None None POLYGON ((-122.2863870000599 47.6884249996142,... 184 POINT (-122.2869415158021 47.68930805452298)
6797 31871.0 0.0 2009 033 S 530330024002009 +47.6839481 -122.2873437 G5040 Block 2009 ... 3.817968e-06 0.007842 002400 2400 2400.2009 None None POLYGON ((-122.2863170004291 47.68485100027363... 185 POINT (-122.2873436716371 47.68394805718418)
6798 16125.0 0.0 1001 033 S 530330039001001 +47.6823465 -122.2843915 G5040 Block 1001 ... 1.931633e-06 0.005561 003900 3900 3900.1001 None None POLYGON ((-122.2836750000011 47.68165000014756... 186 POINT (-122.2843915050001 47.68234645212066)
6799 15295.0 0.0 2003 033 S 530330024002003 +47.6839414 -122.2836269 G5040 Block 2003 ... 1.832268e-06 0.005645 002400 2400 2400.2003 None None POLYGON ((-122.2830910000495 47.68303900034977... 187 POINT (-122.2836269254391 47.68394141932476)
6800 20443.0 0.0 1010 033 S 530330038001010 +47.6766924 -122.2909770 G5040 Block 1010 ... 2.448571e-06 0.006332 003800 3800 3800.1010 None None POLYGON ((-122.2902750003908 47.67578200023928... 190 POINT (-122.290977000002 47.67669239753352)
6801 16956.0 0.0 4019 033 S 530330042004019 +47.6712326 -122.2896688 G5040 Block 4019 ... 2.030710e-06 0.005877 004200 4200 4200.4019 None None POLYGON ((-122.2902140002757 47.67031900012194... 192 POINT (-122.2896687518495 47.6712326369634)
6802 8481.0 0.0 5024 033 S 530330042005024 +47.6694153 -122.2904848 G5040 Block 5024 ... 1.015733e-06 0.004741 004200 4200 4200.5024 None None POLYGON ((-122.2907550000431 47.66851100038252... 193 POINT (-122.2904847531675 47.66941526874729)
6803 16797.0 0.0 4015 033 S 530330042004015 +47.6694125 -122.2863120 G5040 Block 4015 ... 2.011608e-06 0.005842 004200 4200 4200.4015 None None POLYGON ((-122.2857460001776 47.66850800024417... 194 POINT (-122.2863120001985 47.66941250013691)
6804 5596.0 0.0 4027 033 S 530330042004027 +47.6676010 -122.2881468 G5040 Block 4027 ... 6.701254e-07 0.004374 004200 4200 4200.4027 None None POLYGON ((-122.2879550004228 47.66669100008977... 195 POINT (-122.2881467783885 47.667600980184)
6805 16041.0 0.0 1023 033 S 530330039001023 +47.6766913 -122.2854613 G5040 Block 1023 ... 1.921364e-06 0.005748 003900 3900 3900.1023 None None POLYGON ((-122.2849060001117 47.67578500037763... 197 POINT (-122.2854613503495 47.67669128596118)
6806 20395.0 0.0 2005 033 S 530330042002005 +47.6730559 -122.2842037 G5040 Block 2005 ... 2.442689e-06 0.006324 004200 4200 4200.2005 None None POLYGON ((-122.2835230001862 47.67214599983817... 198 POINT (-122.2842036898599 47.67305586415347)
6807 14666.0 0.0 2009 033 S 530330066002009 +47.6375246 -122.3265036 G5040 Block 2009 ... 1.755387e-06 0.005334 006600 6600 6600.2009 None None POLYGON ((-122.3258929998619 47.63678499962822... 201 POINT (-122.3265036202639 47.63752457823468)
6808 6696.0 0.0 2017 033 S 530330066002017 +47.6364661 -122.3263362 G5040 Block 2017 ... 8.014083e-07 0.004124 006600 6600 6600.2017 None None POLYGON ((-122.3255870001398 47.63588500039265... 202 POINT (-122.3263361624568 47.63646613407349)
6809 9548.0 0.0 1003 033 S 530330066001003 +47.6354681 -122.3217676 G5040 Block 1003 ... 1.142727e-06 0.004370 006600 6600 6600.1003 None None POLYGON ((-122.3211519997648 47.6350250003037,... 203 POINT (-122.3217675588585 47.63546812219828)
6810 12208.0 0.0 1006 033 S 530330065001006 +47.6378235 -122.3207156 G5040 Block 1006 ... 1.461162e-06 0.004843 006500 6500 6500.1006 None None POLYGON ((-122.3200819998842 47.63725000038738... 204 POINT (-122.3207155696244 47.63782352078029)
6811 8795.0 0.0 1004 033 S 530330085001004 +47.6066525 -122.3280291 G5040 Block 1004 ... 1.052089e-06 0.004262 008500 8500 8500.1004 None None POLYGON ((-122.3271680002029 47.60651600041325... 223 POINT (-122.3280290603603 47.60665251605801)
6812 9141.0 0.0 1033 033 S 530330082001033 +47.6064259 -122.3309201 G5040 Block 1033 ... 1.093405e-06 0.004335 008200 8200 8200.1033 None None POLYGON ((-122.3300409995923 47.6063000003449,... 224 POINT (-122.3309200877909 47.60642586965254)
6813 22573.0 0.0 2049 033 S 530330093002049 +47.5912475 -122.3357886 G5040 Block 2049 ... 2.699360e-06 0.006746 009300 9300 9300.2049 None None POLYGON ((-122.3351159998034 47.59240199975267... 225 POINT (-122.3357885606562 47.59124745813958)
6814 16099.0 0.0 2047 033 S 530330093002047 +47.5892687 -122.3346595 G5040 Block 2047 ... 1.925155e-06 0.006015 009300 9300 9300.2047 None None POLYGON ((-122.3341969996916 47.59031000040636... 226 POINT (-122.3346595368113 47.58926874993818)
6815 10947.0 0.0 2007 033 S 530330088002007 +47.6085108 -122.3021203 G5040 Block 2007 ... 1.309547e-06 0.004613 008800 8800 8800.2007 None None POLYGON ((-122.3014779999096 47.60800399978496... 228 POINT (-122.3021202540216 47.60851084513048)
6816 16931.0 0.0 1011 033 S 530330088001011 +47.6107910 -122.2994874 G5040 Block 1011 ... 2.025475e-06 0.005714 008800 8800 8800.1011 None None POLYGON ((-122.2988459999428 47.61001399984639... 229 POINT (-122.2994874200522 47.61079101035128)
6817 10963.0 0.0 1023 033 S 530330088001023 +47.6095154 -122.3008094 G5040 Block 1023 ... 1.311398e-06 0.004620 008800 8800 8800.1023 None None POLYGON ((-122.3001620003759 47.60901200040365... 230 POINT (-122.3008093560542 47.60951544318198)
6818 7566.0 0.0 2013 033 S 530330044002013 +47.6719853 -122.3149169 G5040 Block 2013 ... 9.061091e-07 0.004434 004400 4400 4400.2013 None None POLYGON ((-122.3141810002528 47.67215300016102... 238 POINT (-122.314916920368 47.67198530689296)

6819 rows × 22 columns


In [13]:
#plot the blocks and "In Count"
#%matplotlib qt
fig1 = boros.plot(column='InCount', cmap='viridis')
#fig1.colorbar()
plt.show()
plt.colorbar
plt.savefig('map2.pdf')


<matplotlib.figure.Figure at 0x14893470>

In [14]:
#the hel
def heatmap(d, bins=(100,100), smoothing=1.3, cmap='viridis'):
    """
    plot the heat map
    This function takes a GeoDataFrame with point geometries and shows a matplotlib plot of heatmap density 
    """
    def getx(pt):
        return pt.coords[0][0]

    def gety(pt):
        return pt.coords[0][1]

    x = list(d.geometry.apply(getx))
    y = list(d.geometry.apply(gety))
    heatmap, xedges, yedges = np.histogram2d(y, x, bins=bins)
    extent = [yedges[0], yedges[-1], xedges[-1], xedges[0]]
    
    #using numpy's 2D histogram binning with smoothing from scipy
    logheatmap = np.log(heatmap)
    logheatmap[np.isneginf(logheatmap)] = 0
    logheatmap = ndimage.filters.gaussian_filter(logheatmap, smoothing, mode='nearest')
    
    plt.imshow(logheatmap, cmap=cmap, extent=extent)
    plt.colorbar()
    plt.gca().invert_yaxis()
    plt.show()

In [15]:
#create a new data whose “geometry” column is the center of blocks (point geometries)
boros_point = boros.set_geometry('centroid_column')

In [16]:
#plot the piont data
boros_point.plot()
plt.show()



In [17]:
#plot the heat map
heatmap(boros_point, bins=50, smoothing=1.5)



In [ ]: