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.36

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.36
File Size Uploaded Provenance
stats_compass_core-0.1.36.tar.gz 351.0 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 767.8 kB

Release files / stats_compass_core-0.1.36.tar.gz

Download URL stats_compass_core-0.1.36.tar.gz
Size 351.0 kB
Tags Source
SHA-256 checksum
How to use checksums
574db127604b1bd10d13a2e1764af2475f4eacc5a72b5b8150735f595648dde2
BLAKE2b-256 checksum
How to use checksums
375f99c858563d6052cc6285dacb749f8234e69521bd35d9a6469a729891bf9b
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.36-py3-none-any.whl

Download URL stats_compass_core-0.1.36-py3-none-any.whl
Size 416.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8914f52c15522f4f1d97fb57f9d6aa851598de8b0f1c785431049a8f16c0ffcb
BLAKE2b-256 checksum
How to use checksums
20f4e8041465d879ea3288062d0cef427951712ef579d5ef321414340d83e2a8
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.36

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.36 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