{"id":8759,"library":"vega-datasets","title":"Vega Datasets","description":"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.","status":"deprecated","version":"0.9.0","language":"en","source_language":"en","source_url":"https://github.com/altair-viz/vega_datasets","tags":["data","visualization","altair","datasets","deprecated"],"install":[{"cmd":"pip install vega-datasets","lang":"bash","label":"Install standalone package (deprecated)"},{"cmd":"pip install altair>=6.0.0","lang":"bash","label":"Install Altair with built-in datasets (recommended)"}],"dependencies":[{"reason":"Datasets are typically returned as Pandas DataFrames, making Pandas a de-facto dependency for data manipulation and display.","package":"pandas","optional":false}],"imports":[{"note":"The `vega_datasets` package is archived. For Altair versions 6.0.0 and above, datasets are accessed via `altair.datasets`.","wrong":"from vega_datasets import data","symbol":"data","correct":"from altair.datasets import data"}],"quickstart":{"code":"# Old way (vega-datasets 0.9.0 and earlier)\n# Requires: pip install vega-datasets\ntry:\n    from vega_datasets import data\n    cars_df_old = data.cars()\n    print(\"Old import (vega-datasets 0.9.0):\\n\", cars_df_old.head())\n    # Accessing metadata\n    # print(data.cars.description)\nexcept ImportError:\n    print(\"vega-datasets not installed, skipping old import example.\")\n\n# New way (Altair 6.0.0+ with built-in datasets)\n# Requires: pip install altair>=6.0.0\ntry:\n    from altair.datasets import data as altair_data\n    cars_df_new = altair_data.cars()\n    print(\"\\nNew import (Altair 6.0.0+):\\n\", cars_df_new.head())\n    # Accessing metadata\n    # print(altair_data.cars.description)\nexcept ImportError:\n    print(\"\\nAltair 6.0.0+ not installed or older version. Cannot use new import example.\")","lang":"python","description":"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."},"warnings":[{"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`).","message":"The `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.","severity":"breaking","affected_versions":"All versions of `vega-datasets` (0.9.0 and earlier) are affected when upgrading to Altair 6.0.0+."},{"fix":"Update to Altair 6.0.0+ and use `altair.datasets` for consistent access to all Vega datasets.","message":"The 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`.","severity":"deprecated","affected_versions":"All versions up to 0.9.0."},{"fix":"Replace hyphens with underscores when calling dataset methods (e.g., `data.dataset_name()`).","message":"Dataset names containing hyphens (e.g., 'sf-temps') must be accessed using underscores (e.g., `data.sf_temps()`) when using the Python interface.","severity":"gotcha","affected_versions":"All versions of `vega-datasets` and `altair.datasets`."},{"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.","message":"When visualizing large datasets with Altair, you might encounter a `MaxRowsError`. This is a default safeguard in Altair to encourage efficient data handling.","severity":"gotcha","affected_versions":"Altair versions that integrate `vega-datasets`."}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"If working with older Altair versions, ensure `vega-datasets` is installed (`pip install vega-datasets`). If using Altair 6.0.0+, switch your import to `from altair.datasets import data` and ensure `altair` is installed (`pip install altair`).","cause":"The `vega_datasets` package is not installed, or you are attempting to use the old import path (`from vega_datasets import data`) after migrating to Altair 6.0.0+ without installing the standalone `vega_datasets` package.","error":"ModuleNotFoundError: No module named 'vega_datasets'"},{"fix":"To process larger datasets, enable the VegaFusion data transformer: `import altair as alt; alt.data_transformers.enable('vegafusion')`. This requires `vegafusion` to be installed (`pip install vegafusion`). For extremely large datasets, consider passing data by URL.","cause":"Altair's default data transformer limits the size of embedded datasets to prevent performance issues in visualizations.","error":"MaxRowsError: The number of rows in your dataset is greater than the maximum allowed (5000)."},{"fix":"Temporarily disable ad-blockers or privacy extensions for the specific page/domain. Check your browser's developer console (Network tab) for blocked requests or `ERR_BLOCKED_BY_CLIENT` messages. Consider using datasets bundled with Altair or serving them locally.","cause":"Browser ad-blockers, privacy extensions, or strict Content Security Policies (CSPs) might block requests to CDNs (e.g., `cdn.jsdelivr.net`) where some `vega-datasets` are hosted.","error":"Data not loading, chart appears empty or incomplete in browser or Jupyter notebook."}]}