Registry / data / vega-datasets

vega-datasets

JSON →
library0.9.0pypypi✓ verified 84d ago

A Python package providing convenient access to a collection of over 70 datasets used in Vega, Vega-Lite, and Altair examples and documentation. As of Altair 6.0.0, the `vega-datasets` package has been archived, and its functionality, including all datasets, has been integrated directly into the `altair.datasets` module. The last standalone release of `vega-datasets` was 0.9.0.

pip install vega-datasets
INSTALL
IMPORT
SIG · VEGA-DATASETS
V
vega-datasets
datapythonv0.9.0
Install
5.5s avg
Import
1117ms
Disk
126MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.9.0 · 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
py 3.103.940 runs
installs and imports cleanly · install 0.0s · import 1.172s · 88.5MB
glibc
py 3.103.940 runs
installs and imports cleanly · install 5.5s · import 1.062s · 159MB
126MB installed
● package 126MB
Code
Verified usage

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

DataLoader
from vega_datasets import DataLoader
from altair.datasets import data
data
from vega_datasets import data
from altair.datasets import data
LocalDataLoader
from vega_datasets import LocalDataLoader
from altair.datasets import data

Demonstrates loading the 'cars' dataset using both the deprecated `vega_datasets` import and the recommended `altair.datasets` import for newer Altair versions. The datasets are loaded as Pandas DataFrames.

# Old way (vega-datasets 0.9.0 and earlier) # Requires: pip install vega-datasets try: from vega_datasets import data cars_df_old = data.cars() print("Old import (vega-datasets 0.9.0):\n", cars_df_old.head()) # Accessing metadata # print(data.cars.description) except ImportError: print("vega-datasets not installed, skipping old import example.") # New way (Altair 6.0.0+ with built-in datasets) # Requires: pip install altair>=6.0.0 try: from altair.datasets import data as altair_data cars_df_new = altair_data.cars() print("\nNew import (Altair 6.0.0+):\n", cars_df_new.head()) # Accessing metadata # print(altair_data.cars.description) except ImportError: print("\nAltair 6.0.0+ not installed or older version. Cannot use new import example.")
Debug
Known issues
breakingThe `vega-datasets` package has been archived and its functionality migrated to `altair.datasets` in Altair 6.0.0+. Direct `import vega_datasets` will no longer receive updates and is discouraged for new projects.
fix
Migrate `from vega_datasets import data` to `from altair.datasets import data` and ensure Altair 6.0.0 or higher is installed (`pip install altair>=6.0.0`).
affects: All versions of `vega-datasets` (0.9.0 and earlier) are affected when upgrading to Altair 6.0.0+.
deprecatedThe standalone `vega-datasets` PyPI package (version 0.9.0 and earlier) is deprecated. While it remains installable, new datasets and updates are only provided via `altair.datasets`.
fix
Update to Altair 6.0.0+ and use `altair.datasets` for consistent access to all Vega datasets.
affects: All versions up to 0.9.0.
gotchaDataset names containing hyphens (e.g., 'sf-temps') must be accessed using underscores (e.g., `data.sf_temps()`) when using the Python interface.
fix
Replace hyphens with underscores when calling dataset methods (e.g., `data.dataset_name()`).
affects: All versions of `vega-datasets` and `altair.datasets`.
gotchaWhen visualizing large datasets with Altair, you might encounter a `MaxRowsError`. This is a default safeguard in Altair to encourage efficient data handling.
fix
Enable the VegaFusion data transformer (`import altair as alt; alt.data_transformers.enable('vegafusion')`) by installing `vegafusion` (`pip install vegafusion`). Alternatively, pass data by URL if the dataset is hosted remotely, possibly using `altair_data_server` for local files.
affects: Altair versions that integrate `vega-datasets`.
Upgrade
Version history
0.9.0latest on PyPI · released Nov 26, 2020
Audit
Dependencies
pandasrequiredDatasets are typically returned as Pandas DataFrames, making Pandas a de-facto dependency for data manipulation and display.
Agent activity
24 hits · last 30 days
node
22
OpenAI (training)
1
Resources
vega-datasets — pip install vega-datasets · libregistry