Registry / data / pydeck

pydeck

JSON →
library0.9.1pypypi✓ verified 35d ago

pydeck is a Python binding for deck.gl, a WebGL-powered framework for large-scale interactive data visualization. It is optimized for Jupyter environments, enabling users to create powerful geospatial visualizations with a declarative Python API, largely obviating the need for extensive JavaScript knowledge. The current stable version is 0.9.1, which aligns with deck.gl v9.0, and new releases generally follow the major version updates of the underlying deck.gl library.

dataweb-framework
Install & Compatibility
Where this runs
tested against v0.9.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
5/10 runs
5/10 runs
py 3.11
5/10 runs
5/10 runs
py 3.12
5/10 runs
5/10 runs
py 3.13
5/10 runs
5/10 runs
py 3.9
5/10 runs
5/10 runs
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

from pydeck import Deck
from pydeck import Layer
from pydeck import ViewState

Commonly aliased as `pdk` for brevity and convention.

import pydeck as pdk

This quickstart demonstrates how to create a basic 3D heatmap using pydeck's HexagonLayer. It fetches data from a URL, defines a layer with visualization properties, sets an initial camera view, and then renders the map. The map can be displayed directly in a Jupyter environment or exported to a standalone HTML file. An optional Mapbox API key is included for base map rendering.

import pydeck as pdk import pandas as pd import os # Sample data (e.g., 2014 locations of car accidents in the UK) UK_ACCIDENTS_DATA = ( 'https://raw.githubusercontent.com/uber-common/' 'deck.gl-data/master/examples/3d-heatmap/heatmap-data.csv' ) # Define a layer to display on a map layer = pdk.Layer( 'HexagonLayer', data=UK_ACCIDENTS_DATA, get_position=['lng', 'lat'], auto_highlight=True, elevation_scale=50, pickable=True, elevation_range=[0, 3000], extruded=True, coverage=1 ) # Set the viewport location view_state = pdk.ViewState( longitude=-1.415, latitude=52.2323, zoom=6, min_zoom=5, max_zoom=15, pitch=40.5, bearing=-27.36 ) # Render the map r = pdk.Deck( layers=[layer], initial_view_state=view_state, api_keys={'mapbox': os.environ.get('MAPBOX_API_KEY', '')} # Or Google Maps API key ) # To display in a Jupyter environment, use r.show(). # To save to an HTML file: r.to_html('pydeck_quickstart.html')
Debug
Known footguns
breakingAs of pydeck v0.9+, certain advanced Jupyter-specific features, such as binary data transportation, interactive data selection, and real-time data updates, are not currently supported. While `pydeck` still works in Jupyter, users relying on these interactive capabilities may experience a regression or need to adjust their workflows.
gotchapydeck does not always raise Python errors for incorrect or omitted layer arguments. If a visualization fails to render or behaves unexpectedly, users should typically inspect the browser's developer console for JavaScript errors, as `pydeck` translates Python objects to JavaScript for rendering.
gotchaDataframe column names used in `get_` accessors (e.g., `get_position`, `get_fill_color`) should ideally be sanitized to avoid hyphens or whitespace. The underlying JavaScript expression parser may interpret these as arithmetic operations (e.g., `datum.lng - datum.new` instead of `datum['lng-new']`), leading to rendering failures.
gotchaIf data values in a DataFrame column are integers and are used by `get_` accessors that expect floating-point numbers (e.g., for coordinates or elevations), it might lead to unexpected behavior or rendering issues.
gotchaWhile pydeck defaults to Carto basemaps, if you intend to use Mapbox or Google Maps, you will need to provide an API key. These keys can be passed directly to the `Deck` object or set as environment variables (`MAPBOX_API_KEY`, `GOOGLE_MAPS_API_KEY`).
gotchaExecuting pydeck within a Jupyter environment requires Jupyter (and typically ipykernel) to be installed in the Python environment. If Jupyter is not installed or not accessible, any attempts to render pydeck visualizations in a Jupyter context will fail with a 'command not found' error.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
11 hits · last 30 days
gptbot
4
ahrefsbot
3
claudebot
3
commoncrawl
1
Resources