Lecture 3 in-class exercise solution#
Ensure the visualizations render properly across VSCode, Jupyter Book, etc. You can ignore this.
import plotly.io as pio
pio.renderers.default = "colab+notebook_connected+plotly_mimetype"
import pandas as pd
# load all records and force a consistent ordering
parks = pd.read_csv(
"https://data.cityofnewyork.us/resource/enfh-gkve.csv?$limit=3000&$order=globalid"
)
parks
| acquisitiondate | acres | address | borough | class | communityboard | councildistrict | department | gisobjid | gispropnum | ... | pip_ratable | precinct | retired | signname | subcategory | typecategory | us_congress | waterfront | zipcode | multipolygon | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 1934-07-11T00:00:00.000 | 1.800 | W 179 St bet. Cedar Av and Sedgwick Av | X | PARK | 205 | 16 | X-05 | 100005000 | X111 | ... | True | 46 | False | Cedar Playground | Neighborhood Plgd | Neighborhood Park | 13.0 | False | 10453 | MULTIPOLYGON (((-73.91697310271871 40.85481428... |
| 1 | 1926-04-21T00:00:00.000 | 0.271 | Harbor Rd. at Richmond Terr. | R | PARK | 501 | 49 | R-01 | 100003827 | R036 | ... | True | 120 | False | Bobbie Lewis Jr. Playground | Neighborhood Plgd | Neighborhood Park | 11.0 | False | 10303 | MULTIPOLYGON (((-74.16025193367476 40.63669457... |
| 2 | 1945-01-16T00:00:00.000 | 3.380 | 1405 ATLANTIC AVENUE | B | PARK | 303 | 36 | B-03 | 100004719 | B225 | ... | True | 79 | False | St. Andrew's Playground | Neighborhood Plgd | Neighborhood Park | 8.0 | False | 11216 | MULTIPOLYGON (((-73.94148303666111 40.67816967... |
| 3 | 1947-03-13T00:00:00.000 | 0.208 | 610 ROCKAWAY AVENUE | B | PARK | 316 | 41 | B-16 | 100003833 | B227 | ... | True | 73 | False | P.S. 125 Playground | JOP | Playground | 8.0 | False | 11212 | MULTIPOLYGON (((-73.90940657813228 40.66516627... |
| 4 | 1968-07-25T00:00:00.000 | 0.284 | Greystone Av bet. W 236 St and W 240 St | X | PARK | 208 | 11 | X-08 | 100004267 | X224 | ... | True | 50 | False | MacLaughlin Playground | Neighborhood Plgd | Playground | 15.0 | False | 10471 | MULTIPOLYGON (((-73.90512615406934 40.88815910... |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 2053 | 1933-05-24T00:00:00.000 | 0.525 | 317 WEST 16 STREET | M | PARK | 104 | 3 | M-04 | 100004586 | M066 | ... | True | 10 | False | Dr. Gertrude B. Kelly Playground | Neighborhood Plgd | Neighborhood Park | 12.0 | False | 10011 | MULTIPOLYGON (((-74.00197756530805 40.74134480... |
| 2054 | 2002-11-20T00:00:00.000 | 0.172 | 79-85 Montauk St | B | PARK | 305 | 37 | B-05 | 100003705 | B491 | ... | False | 75 | False | Shield Of Faith | Greenthumb | Garden | 7.0 | False | 11208 | MULTIPOLYGON (((-73.87829126928358 40.67745132... |
| 2055 | 1962-09-07T00:00:00.000 | 104.600 | 6320 MARATHON PARKWAY | Q | PARK | 411 | 23 | Q-11 | 100000252 | Q411 | ... | False | 111 | False | Douglaston Park Golf Course | Large Park | Managed Sites | 3.0 | False | 11362 | MULTIPOLYGON (((-73.73320415943988 40.75444962... |
| 2056 | 1947-05-25T00:00:00.000 | 0.964 | Nostrand Ave. between Ave. L and Ave. K | B | PARK | 314 | 45 | B-14 | 100004580 | B287 | ... | True | 70 | False | Andries Playground | JOP | Jointly Operated Playground | 9.0 | False | 11210 | MULTIPOLYGON (((-73.94637406393018 40.62340014... |
| 2057 | 1991-09-03T00:00:00.000 | 1.430 | N. Gannon Ave., Willow Road E., Victory Blvd.,... | R | PARK | 501 | 50 | R-01 | 100004383 | R126 | ... | True | 120 | False | Gaeta Park | Sitting Area/Triangle/Mall | Triangle/Plaza | 11.0 | False | 10314 | MULTIPOLYGON (((-74.15046757766655 40.61042193... |
2058 rows × 33 columns
import plotly.express as px
px.histogram(
parks,
x="borough",
title="Number of parks per borough",
)