import pandas as pd from dagster import op @op def fetch_data() -> list: """Fetches raw data from a source.""" return [{"id": 1, "value": "A"}, {"id": 2, "value": "B"}] @op def process_data(data: list) -> dict: """Processes raw data and returns a summary.""" return {"count": len(data), "status": "success"} @op def generate_example_dataset() -> pd.DataFrame: """Generates a small example dataset as a pandas DataFrame.""" return pd.DataFrame( [ {"order_id": 1001, "customer": "Alice", "quantity": 2, "unit_price": 9.50}, {"order_id": 1002, "customer": "Bob", "quantity": 1, "unit_price": 15.00}, {"order_id": 1003, "customer": "Charlie", "quantity": 4, "unit_price": 7.25}, {"order_id": 1004, "customer": "Dora", "quantity": 3, "unit_price": 11.00}, ] ) @op def transform_example_dataset(df: pd.DataFrame) -> pd.DataFrame: """Applies a simple transformation to the example dataset.""" df["price_band"] = df["total_price"].apply( lambda value: "high" if value >= 25 else "standard" ) df["total_price"] = df["quantity"] * df["unit_price"] return df