Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Principle:Ucbepic Docetl Pandas Semantic Operations

From Leeroopedia


Knowledge Sources
Domains Data_Science, LLM_Operations
Last Updated 2026-02-08 01:40 GMT

Overview

A DataFrame integration principle that enables LLM-powered operations directly on Pandas DataFrames through a semantic accessor API.

Description

Pandas Semantic Operations extends Pandas DataFrames with a .semantic accessor that provides LLM-powered operations (map, filter, reduce, agg, merge, split, gather, unnest) as DataFrame methods. This enables data scientists to use DocETL operations in familiar Pandas workflows without constructing explicit Pipeline objects.

Operations track their history and cumulative costs, enabling reproducible LLM-powered data analysis within Jupyter notebooks and data science scripts.

Usage

Use the .semantic accessor when working with Pandas DataFrames and wanting to add LLM-powered transformations inline. Configure the model with df.semantic.set_config(default_model="gpt-4o").

Theoretical Basis

Accessor-based API extension:

  1. Registration: Pandas accessor registered via @pd.api.extensions.register_dataframe_accessor
  2. Delegation: Each accessor method wraps a DocETL operation and runs it via DSLRunner
  3. History Tracking: Operation history stored in DataFrame.attrs for reproducibility
  4. Cost Accumulation: Cumulative LLM costs tracked across chained operations

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment