Quickstart-Python: H3 NYC Taxi LaGuardia to Manhattan(Python)

Loading...

NYC Taxi Trips between LaGuardia and Manhattan's Financial Districts (Python)

Demonstration of Databricks Built-In H3 API available in DBR 11.2 for Scala, Python and SQL bindings to Spark Clusters.

This example persists tables under Database nyc_taxi, shown under catalog geospatial_docs.

This notebook uses the following public datasets:

  1. Data from Databricks public datasets for NYC Yellow Taxi pickups and dropoffs available under DBFS at /databricks-datasets/nyctaxi/tables/nyctaxi_yellow
  2. Zip codes are included from NYC Data to use in analysis.

NOTE: Run setup_uc_nyc_taxi_trips.py notebook 1x to setup taxi tables within Unity Catalog (UC). If you are not using UC, then you will have to adjust how you choose to make calls to the tables.

Setup

%pip install keplergl --quiet
Python interpreter will be restarted. Python interpreter will be restarted.
from keplergl import KeplerGl

def display_kepler(kmap:KeplerGl) -> None:
    """
    Convenience function to render map in kepler.gl
    - use this when cannot directly render.
    """
    displayHTML(kmap._repr_html_().decode("utf-8"))

Import Databricks functions to get H3; also, import spark functions.

import pprint
from pyspark.databricks.sql.functions import *

from pyspark.sql import functions as F
from pyspark.sql.functions import col, udf
from pyspark.sql.types import *

pp = pprint.PrettyPrinter(indent=4, compact=True)

This example shows catalog geospatial_docs within Unity Catalog; please adjust to your preferred catalog.

Example assumes usage grant on catalog and usage and create grant within database, more at https://www.databricks.com/product/unity-catalog

spark.catalog.setCurrentCatalog("geospatial_docs")
spark.catalog.setCurrentDatabase("nyc_taxi")
# pp.pprint(spark.catalog.listTables())

df_yellow_trip DataFrame

There are 1.6B rows in this data (see note above for setup).

df_yellow_trip = spark.table("yellow_trip")
print(f"count? {df_yellow_trip.count():,}")
# print(df_yellow_trip.printSchema())
display(df_yellow_trip)
count? 1,611,611,035
 
vendor_id
pickup_datetime
dropoff_datetime
passenger_count
trip_distance
pickup_longitude
pickup_latitude
rate_code_id
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
VTS
2009-11-19T10:40:00.000+0000
2009-11-19T10:49:00.000+0000
1
1.64
-73.988087
40.731822
null
VTS
2009-11-20T11:33:00.000+0000
2009-11-20T11:59:00.000+0000
3
3
-73.987065
40.724667
null
VTS
2009-11-20T22:04:00.000+0000
2009-11-20T22:14:00.000+0000
1
1.63
-73.983477
40.726132
null
VTS
2009-11-21T02:12:00.000+0000
2009-11-21T02:17:00.000+0000
4
0.76
-73.98197
40.728307
null
VTS
2009-11-23T10:19:00.000+0000
2009-11-23T10:33:00.000+0000
1
2.42
-73.982778
40.735485
null
VTS
2009-11-21T12:26:00.000+0000
2009-11-21T12:41:00.000+0000
1
4.94
-73.985323
40.731768
null
VTS
2009-11-20T01:29:00.000+0000
2009-11-20T01:39:00.000+0000
1
2.25
-73.987977
40.728437
null
VTS
2009-11-21T02:29:00.000+0000
2009-11-21T02:39:00.000+0000
1
4.47
-73.98878
40.722638
null
VTS
2009-11-20T19:44:00.000+0000
2009-11-20T19:53:00.000+0000
1
4.28
-73.987592
40.732983
null
VTS
2009-11-21T04:52:00.000+0000
2009-11-21T05:05:00.000+0000
1
3.04
-73.986622
40.69995
null
VTS
2009-11-17T14:13:00.000+0000
2009-11-17T14:23:00.000+0000
5
1.12
-73.985165
40.728428
null
VTS
2009-11-18T09:19:00.000+0000
2009-11-18T09:29:00.000+0000
1
1.31
-73.986143
40.722267
null
VTS
2009-11-18T21:49:00.000+0000
2009-11-18T21:59:00.000+0000
1
2.23
-73.987738
40.729457
null
VTS
2009-11-19T17:50:00.000+0000
2009-11-19T18:27:00.000+0000
1
6.57
-73.9807
40.720483
null
VTS
2009-11-18T22:10:00.000+0000
2009-11-18T22:28:00.000+0000
1
4.28
-73.97901
40.723945
null
VTS
2009-11-21T12:55:00.000+0000
2009-11-21T13:01:00.000+0000
2
1.18
-73.980677
40.72572
null
VTS
2009-11-19T01:13:00.000+0000
2009-11-19T01:19:00.000+0000
1
1.49
-73.9881
40.732112
null
1,000 rows|Truncated data

df_nyc_zipcode DataFrame

The yellow_trip table lets us know place, time, passengers, and cost but we also want to understand zip codes of the pickups and dropoffs, verify data is setup (see instructions at start of notebook).

df_nyc_zipcode = spark.table("nyc_zipcode")
print(f"count? {df_nyc_zipcode.count():,}")
# print(df_nyc_zipcode.printSchema())
display(df_nyc_zipcode)
count? 263
 
ZIPCODE
BLDGZIP
PO_NAME
POPULATION
AREA
STATE
COUNTY
ST_FIPS
CTY_FIPS
URL
SHAPE_AREA
1
2
3
4
5
6
7
8
9
10
11
12
13
14
11214
0
Brooklyn
89061
61096539.3891465
NY
Kings
36
047
http://www.usps.com/
0
11691
0
Far Rockaway
60267
83927815.1123475
NY
Queens
36
081
http://www.usps.com/
0
11096
0
Inwood
147
111973.73396184
NY
Queens
36
081
http://www.usps.com/
0
11223
0
Brooklyn
79864
58702923.4662996
NY
Kings
36
047
http://www.usps.com/
0
11693
0
Far Rockaway
11052
1527599.16446935
NY
Queens
36
081
http://www.usps.com/
0
11692
0
Arverne
18018
23992395.3811918
NY
Queens
36
081
http://www.usps.com/
0
11235
0
Brooklyn
76130
69053803.0317134
NY
Kings
36
047
http://www.usps.com/
0
11693
0
Far Rockaway
11052
12270916.5305379
NY
Queens
36
081
http://www.usps.com/
0
10306
0
Staten Island
55602
174102872.04866
NY
Richmond
36
085
http://www.usps.com/
0
11694
0
Rockaway Park
20163
48101606.6144704
NY
Queens
36
081
http://www.usps.com/
0
11224
0
Brooklyn
49600
46701983.7536391
NY
Kings
36
047
http://www.usps.com/
0
10471
0
Bronx
23477
89651407.0583499
NY
Bronx
36
005
http://www.usps.com/
0
10470
0
Bronx
14740
21543461.581388
NY
Bronx
36
005
http://www.usps.com/
0
10466
0
Bronx
68942
55262490.6124597
NY
Bronx
36
005
http://www.usps.com/
0
17 rows|Truncated data

Generate H3 Tables

While these could be a view as well, persisting as a table for a 1x cost to setup.

df_nyc_zipcode_h3_12 -- Write as Table

Uses h3_polyfillash3 function to fill the polygon at resolution 12.

(
  df_nyc_zipcode
    .select(
      F.explode(h3_polyfillash3("geom_wkt",12)).alias("cell"),
      "zipcode", "po_name", "county"
    )
  .write
    .mode("ignore") # <-- "overwrite" to replace, "ignore" to skip if exists
    .option("mergeSchema", "true")
  .saveAsTable("nyc_zipcode_h3_12")
)

# sql("optimize nyc_zipcode_h3_12 zorder by (cell)") # <-- optional: z-order by 'cell'

df_nyc_zipcode_h3_12 = spark.table("nyc_zipcode_h3_12")
display(df_nyc_zipcode_h3_12)
 
cell
zipcode
po_name
county
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
631243922750381000
10170
New York
New York
631243922750317000
10170
New York
New York
631243922750317600
10170
New York
New York
631243922750318100
10170
New York
New York
631243922750310400
10170
New York
New York
631243922750318600
10170
New York
New York
631243922750423600
10170
New York
New York
631243922750319600
10170
New York
New York
631243922750424600
10170
New York
New York
631243922750425600
10170
New York
New York
631243922750426100
10170
New York
New York
631243922750426600
10170
New York
New York
631243922750322200
10170
New York
New York
631243922750379000
10170
New York
New York
631243922750322700
10170
New York
New York
631243922750395400
10170
New York
New York
631243922750380500
10170
New York
New York
1,000 rows|Truncated data

df_yellow_trip_h3_12 -- Write as Table

Uses h3_longlatash3 to identify the resolution 12 cell for each point. Recommend running on an autoscaling cluster with ~2-8 nodes.

(
  df_yellow_trip
    .select(
      h3_longlatash3("pickup_longitude", "pickup_latitude", 12).alias("pickup_cell"),
      h3_longlatash3("dropoff_longitude", "dropoff_latitude", 12).alias("dropoff_cell"),
      "*"
    )
    .drop(
      "rate_code_id",
      "store_and_fwd_flag"
    )
  .write
    .mode("ignore") # <-- "overwrite" to replace, "ignore" to skip if exists
    .option("mergeSchema", "true")
  .saveAsTable("yellow_trip_h3_12")
)

# sql("optimize yellow_trip_h3_12 zorder by (pickup_cell)") # <-- optional: z-order by 'pickup_cell'

df_yellow_trip_h3_12 = spark.table("yellow_trip_h3_12")
display(df_yellow_trip_h3_12.filter(col("pickup_cell").isNotNull()))
 
pickup_cell
dropoff_cell
vendor_id
pickup_datetime
dropoff_datetime
passenger_count
trip_distance
payment_type
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
631243923072242700
631243923072240600
CMT
2009-02-26T09:57:36.000+0000
2009-02-26T10:23:58.000+0000
1
8.5
Cash
631243923052516900
631243922921366500
VTS
2009-02-23T12:51:00.000+0000
2009-02-23T13:06:00.000+0000
1
6.49
CASH
631243923063333900
631243923055106000
VTS
2009-02-25T10:43:00.000+0000
2009-02-25T10:55:00.000+0000
1
2.08
Credit
631243923108436000
631243949901922800
VTS
2009-02-20T17:23:00.000+0000
2009-02-20T18:08:00.000+0000
4
20.7
CASH
631243923050748400
631243923051081200
VTS
2009-02-25T06:28:00.000+0000
2009-02-25T06:31:00.000+0000
5
0.52
CASH
631243923110172200
631243922753399300
VTS
2009-02-13T21:03:00.000+0000
2009-02-13T21:34:00.000+0000
3
12.42
Credit
631243923058140200
631243923138757600
VTS
2009-02-07T20:01:00.000+0000
2009-02-07T20:06:00.000+0000
5
0.66
CASH
631243923086595600
631243923095369700
CMT
2009-02-05T09:43:04.000+0000
2009-02-05T09:45:21.000+0000
1
0.3
Cash
631243923052606000
631243923052606000
CMT
2009-02-27T19:10:15.000+0000
2009-02-27T19:17:04.000+0000
2
0.6
Credit
631243923108479500
631243923108479500
CMT
2009-02-02T06:52:03.000+0000
2009-02-02T07:00:29.000+0000
2
1
Cash
631243923056946700
631243949788020200
CMT
2009-02-28T16:07:02.000+0000
2009-02-28T16:36:45.000+0000
1
13.7
Credit
631243923057577000
631243923057577000
CMT
2009-02-24T14:07:30.000+0000
2009-02-24T14:07:33.000+0000
1
0
Dispute
631243923072368100
631243923072362000
CMT
2009-02-09T20:18:13.000+0000
2009-02-09T20:36:21.000+0000
1
9
Credit
631243923110626300
631243922754710500
CMT
2009-02-11T08:22:22.000+0000
2009-02-11T09:14:48.000+0000
1
13.3
Cash
631243923050583000
631243923270468600
CMT
2009-02-18T08:01:47.000+0000
2009-02-18T08:33:25.000+0000
1
16.7
Cash
631243923059069400
631243923059071000
CMT
2009-02-06T11:43:22.000+0000
2009-02-06T11:50:56.000+0000
1
2.4
Cash
631243923058645000
631243923058645000
CMT
2009-02-08T14:39:50.000+0000
2009-02-08T14:46:20.000+0000
1
2
Cash
1,000 rows|Truncated data

Analyze Trips between LaGuardia (LGA) and Manhattan's Financial District Zip Codes

LGA is exclusively within 11371 and Financial District Zip Codes are 10004, 10005, 10006, 10007, 10038

df_lga_pickup_h3_12

All 25M pickups from LGA zip code. You can make this a table to speed up subsequent queries.

df_lga_pickup_h3_12 = (
  df_yellow_trip_h3_12
    .join(df_nyc_zipcode_h3_12.filter("zipcode = '11371'"), col("pickup_cell") == col("cell"), "inner")
)

print(f"count? {df_lga_pickup_h3_12.count():,}")
# print(df_lga_pickup_h3_12.printSchema())
display(df_lga_pickup_h3_12)
count? 25,250,015
 
pickup_cell
dropoff_cell
vendor_id
pickup_datetime
dropoff_datetime
passenger_count
trip_distance
payment_type
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
631243923274515000
631243922754409000
CMT
2011-04-22T20:32:04.000+0000
2011-04-22T20:47:22.000+0000
1
8.2
CRD
631243923274517500
631243949785670700
CMT
2011-04-02T19:57:58.000+0000
2011-04-02T20:28:29.000+0000
4
10
CSH
631243923274517500
631243922841748500
CMT
2011-04-18T22:59:11.000+0000
2011-04-18T23:16:25.000+0000
1
10
CRD
631243923274515500
631243949844354600
CMT
2011-04-24T19:08:14.000+0000
2011-04-24T19:33:27.000+0000
1
9.6
CRD
631243923274517500
631243923190459400
CMT
2011-04-18T22:19:51.000+0000
2011-04-18T22:26:55.000+0000
1
2.4
CRD
631243923274524700
631243949853421000
CMT
2011-04-18T15:13:30.000+0000
2011-04-18T15:39:36.000+0000
4
9.2
CRD
631243923274521100
631243921442888200
CMT
2011-04-24T11:39:21.000+0000
2011-04-24T12:00:31.000+0000
1
8.8
CRD
631243923274521100
631243921532958700
CMT
2011-04-24T15:39:15.000+0000
2011-04-24T15:50:53.000+0000
1
5.9
CRD
631243923274521100
631243921491670500
CMT
2011-04-24T22:36:55.000+0000
2011-04-24T22:59:57.000+0000
2
10.8
CRD
631243923274517500
631243922760639500
CMT
2011-04-18T16:18:22.000+0000
2011-04-18T16:47:51.000+0000
2
10.3
CRD
631243923274515000
631243922727328300
CMT
2011-04-20T20:56:21.000+0000
2011-04-20T21:11:33.000+0000
1
8
CRD
631243923275009000
631243922469889000
CMT
2011-04-20T13:32:40.000+0000
2011-04-20T13:54:04.000+0000
1
9
CRD
631243923274524200
631243921463532500
CMT
2011-04-21T11:50:31.000+0000
2011-04-21T12:20:59.000+0000
1
8.8
CRD
631243923274517500
631243922819902500
CMT
2011-04-18T21:53:27.000+0000
2011-04-18T22:12:27.000+0000
1
10.2
CSH
631243923274515000
631243922787123700
CMT
2011-04-02T23:10:59.000+0000
2011-04-02T23:26:11.000+0000
1
8.7
CSH
631243923274517000
631243949846520300
CMT
2011-04-20T14:22:41.000+0000
2011-04-20T14:43:18.000+0000
2
9
CSH
631243923274521100
631243921459697200
CMT
2011-04-19T23:34:00.000+0000
2011-04-19T23:51:10.000+0000
2
8.4
CSH
1,000 rows|Truncated data

df_fd_dropoff_h3_12

All 34M dropoffs in Manhattan's Financial Districts.

df_fd_dropoff_h3_12 = (
  df_yellow_trip_h3_12
    .join(df_nyc_zipcode_h3_12.filter(col("zipcode").isin("10004", "10005", "10006", "10007", "10038")), col("dropoff_cell") == col("cell"), "inner")
)

print(f"count? {df_fd_dropoff_h3_12.count():,}")
# print(df_fd_dropoff_h3_12.printSchema())
display(df_fd_dropoff_h3_12)
count? 34,306,823
 
pickup_cell
dropoff_cell
vendor_id
pickup_datetime
dropoff_datetime
passenger_count
trip_distance
payment_type
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
631243923108436000
631243949901922800
VTS
2009-02-20T17:23:00.000+0000
2009-02-20T18:08:00.000+0000
4
20.7
CASH
631243923097570800
631243949903032800
VTS
2009-02-04T08:55:00.000+0000
2009-02-04T09:25:00.000+0000
1
12.63
CASH
631243923111621100
631243949903373800
VTS
2009-02-05T18:42:00.000+0000
2009-02-05T19:21:00.000+0000
5
14.75
CASH
631243923109282300
631243949904323600
VTS
2009-02-04T06:14:00.000+0000
2009-02-04T06:35:00.000+0000
1
10.04
CASH
631243923110625800
631243949983000600
VTS
2009-02-24T13:31:00.000+0000
2009-02-24T13:56:00.000+0000
1
16.45
Credit
631243923119684100
631243949967578100
VTS
2009-02-07T20:21:00.000+0000
2009-02-07T20:45:00.000+0000
5
12.32
CASH
631243923110625800
631243949903225300
VTS
2009-02-22T14:35:00.000+0000
2009-02-22T15:16:00.000+0000
1
15.9
CASH
631243923092362200
631243949902537700
CMT
2009-02-09T14:58:22.000+0000
2009-02-09T15:32:34.000+0000
1
15.7
Credit
631243923097143300
631243949901666800
VTS
2009-02-01T01:50:00.000+0000
2009-02-01T02:12:00.000+0000
1
11.57
CASH
631243923097569800
631243949903025700
CMT
2009-02-18T08:51:29.000+0000
2009-02-18T09:21:20.000+0000
1
12.5
Cash
631243923096942600
631243949963164200
VTS
2009-02-03T09:32:00.000+0000
2009-02-03T10:10:00.000+0000
1
10.69
Credit
631243923097605100
631243949902050800
VTS
2009-02-06T08:55:00.000+0000
2009-02-06T09:20:00.000+0000
1
12.32
Credit
631243923105541600
631243949901878800
VTS
2009-02-16T06:03:00.000+0000
2009-02-16T06:33:00.000+0000
1
11.44
Credit
631243923105620500
631243949901932000
VTS
2009-02-09T05:49:00.000+0000
2009-02-09T06:20:00.000+0000
1
11.53
CASH
631243923051308500
631243949894424000
VTS
2009-02-13T07:18:00.000+0000
2009-02-13T07:33:00.000+0000
1
7.99
Credit
631243923108779500
631243949902583300
CMT
2009-02-15T18:24:44.000+0000
2009-02-15T19:04:48.000+0000
3
19.4
Credit
631243923108412400
631243949903103000
DDS
2009-02-25T15:19:38.000+0000
2009-02-25T16:01:47.000+0000
1
19.3
CREDIT
1,000 rows|Truncated data

df_lga_fd_dropoff_h3_12

Join df_fd_dropoff_h3_12 on df_lga_pickup_h3_12 to get all 827K dropoffs in the Financial District which were picked-up around LGA.

lga_pickup_cells = [r[0] for r in df_lga_pickup_h3_12.select("pickup_cell").distinct().collect()]
print(f"len? {len(lga_pickup_cells):,}")
pp.pprint(lga_pickup_cells[:5])
len? 9,010 [ 631243922962186751, 631243922954476031, 631243923195848191, 631243922962204159, 631243922963278335]
df_lga_fd_dropoff_h3_12 = (
  df_fd_dropoff_h3_12
    .filter(
      col("pickup_cell")
        .isin(*lga_pickup_cells)
    )
)

print(f"count? {df_lga_fd_dropoff_h3_12.count():,}")
# print(df_lga_fd_dropoff_h3_12.printSchema())
display(df_lga_fd_dropoff_h3_12)
count? 827,797
 
pickup_cell
dropoff_cell
vendor_id
pickup_datetime
dropoff_datetime
passenger_count
trip_distance
payment_type
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
631243923274515500
631243949901990900
VTS
2011-04-28T22:29:00.000+0000
2011-04-28T23:01:00.000+0000
5
12.81
CRD
631243923274515500
631243949903223800
VTS
2011-04-27T15:11:00.000+0000
2011-04-27T15:37:00.000+0000
1
1.06
CSH
631243923274517000
631243949894571500
CMT
2011-04-26T12:03:50.000+0000
2011-04-26T12:34:42.000+0000
1
6.1
CSH
631243923274517500
631243949905300500
VTS
2011-04-07T08:29:00.000+0000
2011-04-07T09:14:00.000+0000
1
12.12
CSH
631243923274525700
631243949893708800
VTS
2011-04-06T00:32:00.000+0000
2011-04-06T01:06:00.000+0000
1
13.82
CRD
631243923274516000
631243949903028700
VTS
2011-04-11T07:57:00.000+0000
2011-04-11T08:48:00.000+0000
1
1.06
CRD
631243923274524200
631243949902213600
CMT
2011-04-10T18:14:41.000+0000
2011-04-10T18:43:36.000+0000
1
16.4
CSH
631243923274515500
631243949894543400
VTS
2011-04-14T23:52:00.000+0000
2011-04-15T00:23:00.000+0000
1
13.01
CRD
631243923274517500
631243949967567400
VTS
2011-04-14T21:56:00.000+0000
2011-04-14T22:20:00.000+0000
1
11.96
CRD
631243923274501600
631243949901953000
VTS
2011-04-16T14:23:00.000+0000
2011-04-16T14:46:00.000+0000
1
15.01
CRD
631243923274524200
631243949905300000
CMT
2011-04-12T11:05:00.000+0000
2011-04-12T11:43:06.000+0000
1
14.9
CRD
631243923274521100
631243949966950900
CMT
2011-04-17T20:17:15.000+0000
2011-04-17T20:40:41.000+0000
2
11.8
CSH
631243923274524200
631243949967420900
VTS
2011-04-21T08:58:00.000+0000
2011-04-21T09:55:00.000+0000
1
17.3
CRD
631243923274517500
631243949903099900
CMT
2010-12-27T13:37:01.000+0000
2010-12-27T14:04:01.000+0000
2
14.1
CSH
631243923274524200
631243949902216700
CMT
2010-12-05T10:51:53.000+0000
2010-12-05T11:16:38.000+0000
1
13.2
CSH
631243923274509800
631243949901710800
VTS
2010-12-05T18:49:00.000+0000
2010-12-05T19:17:00.000+0000
1
12.23
CRD
631243923274524200
631243949902324700
VTS
2010-12-06T21:04:00.000+0000
2010-12-06T21:25:00.000+0000
1
12.15
CRD
1,000 rows|Truncated data

Dropoffs per Financial District Zip Code

display(
  df_lga_fd_dropoff_h3_12
    .groupBy("zipcode")
      .count()
    .orderBy("zipcode")
)
 
zipcode
count
1
2
3
4
5
10004
149686
10005
184103
10006
108879
10007
197813
10038
187316
5 rows

Here is a reduced-size screenshot of the bar chart rendered in the imported notebook.

Show code

Dropoffs per H3 Cell within each Financial District Zip Code

Uses h3_h3tostring for KeplerGL

df_dropoff = (
  df_lga_fd_dropoff_h3_12
    .select(
      "zipcode",
      h3_h3tostring("dropoff_cell").alias("dropoff_cell")
    )
    .groupBy("zipcode","dropoff_cell")
      .count()
    .withColumn("count_disp", F.format_number("count",0))
    .orderBy("zipcode", F.desc("count"))
)
pdf_dropoff = df_dropoff.toPandas() # <-- convert to pandas for Kepler
print(f"count? {df_dropoff.count():,}")
display(df_dropoff.limit(5))
count? 5,608
 
zipcode
dropoff_cell
count
count_disp
1
2
3
4
5
10004
8c2a10728a963ff
1836
1,836
10004
8c2a10728a905ff
1682
1,682
10004
8c2a1072815cdff
1575
1,575
10004
8c2a1072815c9ff
1541
1,541
10004
8c2a10728a907ff
1468
1,468
5 rows

Render H3 Financial District Dropoffs

Note: you can adjust the color scale, default renders red as lower and yellow as higher values.

map_1 = KeplerGl(height=600, config={'mapState': {'latitude': 40.71, 'longitude': -74.01, 'zoom': 14}})
map_1.add_data(data=pdf_dropoff, name="LGA Financial District Dropoffs")
display_kepler(map_1)
User Guide: https://docs.kepler.gl/docs/keplergl-jupyter

Here is a reduced-size screenshot of what is rendered with kepler in the imported notebook.

Show code