Registry / data / dagster-pandas

dagster-pandas

JSON →
library0.29.20pypypi✓ verified 25d ago

dagster-pandas is a library within the Dagster ecosystem that provides utilities for working with Pandas DataFrames. It enhances Dagster's capabilities by offering DataFrame-level validation, summary statistics generation, and reliable serialization/deserialization for Pandas objects. Currently at version 0.29.0, its release cadence is tied closely to the main Dagster core releases.

pip install dagster-pandas
INSTALL
IMPORT
SIG · DAGSTER-PANDAS
D
dagster-pandas
datapythonv0.29.20
Install
19.0s avg
Import
2718ms
Disk
283MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.29.20 · 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.95 runs
installs and imports cleanly · install 0.0s · import 2.832s · 274.1MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 19.0s · import 2.604s · 262MB
283MB installed
● package 283MB
Code
Verified usage

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

asset
from dagster import asset
Definitions
from dagster import Definitions
load_assets_from_modules
from dagster import load_assets_from_modules
create_dagster_pandas_dataframe_type
from dagster_pandas import create_dagster_pandas_dataframe_type
Used for creating custom Dagster types with Pandas DataFrame schema validation.
PandasColumn
from dagster_pandas import PandasColumn
Used in conjunction with `create_dagster_pandas_dataframe_type` for column-level constraints.

This quickstart demonstrates defining two Dagster assets using Pandas. The `raw_data_csv` asset simulates loading data into a DataFrame, and `processed_data` transforms it by filtering based on age. To run, save the code as a Python file, execute `dagster dev -f <your_file.py>`, and then use the Dagster UI to materialize the assets.

import os import pandas as pd from dagster import asset, Definitions, load_assets_from_modules # --- defs/data/sample_data.csv --- # name,age,city # Alice,25,New York # Bob,35,San Francisco # Charlie,45,Chicago # Diana,28,Boston # --- defs/assets.py --- @asset def raw_data_csv() -> pd.DataFrame: # In a real scenario, this would read from a persistent store, e.g., S3 or a database # For quickstart, we simulate by creating a DataFrame data = { 'name': ['Alice', 'Bob', 'Charlie', 'Diana'], 'age': [25, 35, 45, 28], 'city': ['New York', 'San Francisco', 'Chicago', 'Boston'] } return pd.DataFrame(data) @asset def processed_data(raw_data_csv: pd.DataFrame) -> pd.DataFrame: return raw_data_csv[raw_data_csv['age'] > 30].copy() # --- definitions.py --- # Assuming assets.py is in a 'defs' directory or in the same file for quickstart all_assets = load_assets_from_modules([__name__]) # Load assets from this file defs = Definitions(assets=all_assets) # To run this, save as a Python file (e.g., my_project.py) and run: # dagster dev -f my_project.py # Then open http://localhost:3000 and materialize 'processed_data'
Debug
Known issues
breakingDagster core and library versions are tightly coupled. While libraries like `dagster-pandas` follow their own semantic versioning, major changes in Dagster core can necessitate upgrades or adjustments in library usage. Always check the Dagster core changelog for breaking changes relevant to your setup.
fix
Consult the Dagster documentation and release notes for both `dagster` and `dagster-pandas` when upgrading. Test your pipelines thoroughly after any version bump.
affects: All versions
gotchaFeatures such as `create_dagster_pandas_dataframe_type` and `PandasColumn` are often marked as 'beta' or 'preview' in the Dagster API. This means they might introduce breaking changes in minor versions or have behavior changes in patch releases.
fix
Review the API lifecycle stages documentation for any components you use. Be prepared for potential adjustments if relying on beta/preview features, especially during upgrades.
affects: All versions
gotchaPandas operations, especially on large DataFrames, can be memory-intensive and lead to Out Of Memory (OOM) errors. This is a common pitfall when processing big datasets within Dagster pipelines without proper memory management or architectural considerations.
fix
For large datasets, consider techniques like chunked processing, optimizing DataFrame data types, or using more memory-efficient alternatives if the problem persists. Focus on I/O and query optimization before Python code optimization.
affects: All versions
gotchaDagster's layered execution model can sometimes make Python stack traces less developer-friendly, obscuring the direct cause of errors within your Pandas transformation logic.
fix
Utilize Dagster's structured logging (`context.log`) within your assets to emit clear messages and intermediate values. Isolate and test Pandas logic outside the Dagster environment during development to debug complex issues more easily.
affects: All versions
gotchaPython version compatibility is crucial. While `dagster-pandas` specifies `Python <3.15, >=3.10`, Dagster core regularly drops support for Python versions that reach End Of Life (EOL). Running on an unsupported Python version can lead to unexpected issues.
fix
Regularly check Dagster's Python version support in its documentation. Ensure your environment uses a Python version compatible with both your Dagster core and `dagster-pandas` installations.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'pandas'
The 'pandas' library, a core dependency for 'dagster-pandas', is not installed in the Python environment where Dagster is running, or the environment is not correctly activated.
fix
Install pandas using pip or ensure your virtual environment is activated. If using Docker, add 'pandas' to your requirements file. `pip install pandas` or `pip install dagster-pandas` (as `dagster-pandas` depends on `pandas`).
dagster.core.errors.DagsterTypeCheckError: Type check failed
An output DataFrame did not conform to the schema or constraints defined by a `create_dagster_pandas_dataframe_type` or `PandasColumn` type check, often due to mismatched column names, data types, or violated custom constraints.
fix
Inspect the DataFrame's structure and data (e.g., `df.head()`, `df.info()`, `df.describe()`) and compare it against the `PandasColumn` definitions. Adjust either the DataFrame transformation or the schema definition to match. Debugging might involve logging the DataFrame before it's returned by the op.
AttributeError: type object 'DataFrame' has no attribute 'read_csv'
This error typically occurs when a user tries to call `read_csv` directly on a DataFrame *instance* or the `dagster_pandas.DataFrame` type, instead of calling it as a method of the `pandas` module itself (e.g., `pd.read_csv`).
fix
Ensure you import pandas as `import pandas as pd` and then use `pd.read_csv()` to read CSV files. `dagster_pandas.DataFrame` is a Dagster type for validation, not a functional object for reading data.
TypeError: Object of type 'date' is not JSON serializable
This error often arises when `dagster-pandas` attempts to serialize a Pandas DataFrame containing Python `date` or `datetime` objects in its columns into a format that does not natively support them (e.g., JSON metadata). This can happen during intermediate storage or when emitting metadata.
fix
Convert date/datetime columns to a serializable string format (e.g., ISO 8601) or a Unix timestamp before the DataFrame is passed through Dagster's serialization boundaries, especially if it's involved in metadata or stored as a basic type. For example: `df['date_column'] = df['date_column'].dt.strftime('%Y-%m-%d %H:%M:%S')`.
Upgrade
Version history
0.29.20latest on PyPI · released Aug 27, 2026
Audit
Dependencies
pandasrequiredCore functionality relies on Pandas DataFrames.
dagsterrequiredThis is a library for the Dagster orchestration framework.
Agent activity
18 hits · last 30 days
node
16
OpenAI (training)
1
Resources
dagster-pandas — pip install dagster-pandas · libregistry