Skip to main content
Stats Compass Logo

stats-compass-core

Stateful pandas toolkit for AI agents. 50+ data tools via MCP.

PyPI version Python 3.11+ License: MIT

What is this?

A Python library that turns pandas operations into JSON-serializable tools for LLM agents. Unlike raw pandas, it manages server-side state. DataFrames and trained models persist across tool calls.

Looking for the MCP server? See stats-compass-mcp.

Quick Start

pip install stats-compass-core[all]
from stats_compass_core import DataFrameState, registry
import pandas as pd

# Initialize state (one per session)
state = DataFrameState()

# Load data
df = pd.read_csv("data.csv")
state.set_dataframe(df, name="my_data", operation="load")

# Call tools via registry
result = registry.invoke("eda", "describe", state, {"dataframe_name": "my_data"})
print(result.model_dump_json())  # JSON-serializable output

# Run complete workflows
result = registry.invoke("workflows", "run_classification", state, {
    "target_column": "churn",
    "feature_columns": ["age", "tenure", "balance"],
    "config": {"model_type": "random_forest", "generate_plots": True}
})

What's Included

Category Tools Description
Data load_csv, get_schema, list_dataframes Load and inspect data
Cleaning drop_na, impute, dedupe, handle_outliers, convert_dtype Clean messy data
Transforms filter, groupby, pivot, encode, scale Reshape and transform
EDA describe, correlations, hypothesis_test Statistical analysis
Plots histogram, scatter, bar, roc_curve Visualizations (base64 PNG)
ML train_*, evaluate, predict, cross_validate Machine learning
Workflows run_preprocessing, run_classification, run_regression Multi-step pipelines

See docs/TOOLS.md for the complete list of 50+ tools.

Architecture

┌─────────────────────────────────────────────────────────────────┐
│                     stats-compass-core                          │
│  ┌─────────────────────────────────────────────────────────┐    │
│  │                   DataFrameState                        │    │
│  │  ┌─────────────┐  ┌─────────────┐  ┌─────────────┐      │    │
│  │  │ DataFrames  │  │   Models    │  │   History   │      │    │
│  │  │ (by name)   │  │  (by ID)    │  │  (lineage)  │      │    │
│  │  └─────────────┘  └─────────────┘  └─────────────┘      │    │
│  └─────────────────────────────────────────────────────────┘    │
│                              │                                  │
│              ┌───────────────┼───────────────┐                  │
│              ▼               ▼               ▼                  │
│  ┌──────────────────┐ ┌──────────────┐ ┌───────────────────┐    │
│  │ Workflow Tools   │ │  Sub-Tools   │ │  Result Models    │    │
│  │  (orchestrate)   │ │  (atomic)    │ │  (JSON-safe)      │    │
│  └──────────────────┘ └──────────────┘ └───────────────────┘    │
└─────────────────────────────────────────────────────────────────┘

Key concepts:

  1. DataFrameState - Stores DataFrames and models server-side
  2. Registry - Discovers and invokes tools by category/name
  3. Result Models - All tools return Pydantic models (JSON-serializable)
  4. Workflows - High-level tools that chain sub-tools together

See ARCHITECTURE.md for detailed design docs.

Installation Options

Use Case Command
Core only (data, cleaning, EDA) pip install stats-compass-core
With ML (scikit-learn) pip install stats-compass-core[ml]
With plotting (matplotlib) pip install stats-compass-core[plots]
With time series (statsmodels) pip install stats-compass-core[timeseries]
Everything pip install stats-compass-core[all]

Documentation

Development

git clone https://github.com/oogunbiyi21/stats-compass-core.git
cd stats-compass-core
poetry install --with dev
poetry run pytest

See docs/CONTRIBUTING.md for contribution guidelines.

License

MIT

Metadata

Release files for stats-compass-core 0.1.38

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for stats-compass-core 0.1.38
File Size Uploaded Provenance
stats_compass_core-0.1.38.tar.gz 380.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for stats-compass-core 0.1.38
File Interpreter ABI Platform
stats_compass_core-0.1.38-py3-none-any.whl Python 3 none any Details

Total release size: 833.5 kB

Release files / stats_compass_core-0.1.38.tar.gz

Download URL stats_compass_core-0.1.38.tar.gz
Size 380.3 kB
Tags Source
SHA-256 checksum
How to use checksums
b085f12bff1bca50c0cfbf9442390de063939138279f9b32db06d6fe2dabcf7e
BLAKE2b-256 checksum
How to use checksums
4857d2c1f7538b49fec1b362096bbcc9f8f40b68ac97c88c1dbc11d63e80f389
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.12.5 Darwin/24.6.0

Release files / stats_compass_core-0.1.38-py3-none-any.whl

Download URL stats_compass_core-0.1.38-py3-none-any.whl
Size 453.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
246a1bf89ce3e8a4a0af0cc810867f4f87a94bd35a074ce92d410707fe339390
BLAKE2b-256 checksum
How to use checksums
ff5577f93b95c0eea67ccd98e4c8b97776dabc8a012c97d5a3aa4c22b47e72a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.12.5 Darwin/24.6.0

Security for stats-compass-core 0.1.38

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.38 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page