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

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.37
File Size Uploaded Provenance
stats_compass_core-0.1.37.tar.gz 377.3 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 827.4 kB

Release files / stats_compass_core-0.1.37.tar.gz

Download URL stats_compass_core-0.1.37.tar.gz
Size 377.3 kB
Tags Source
SHA-256 checksum
How to use checksums
62d8dfc323aa5800e0efa6a9bb197c79ee05fe2afb5a939d1c7e9ba4ea0d0633
BLAKE2b-256 checksum
How to use checksums
66bfa0e9967a7ecc4f4e37455b0686b349d440837213f156f1d961448797a698
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.37-py3-none-any.whl

Download URL stats_compass_core-0.1.37-py3-none-any.whl
Size 450.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6b05cb15f2c55e830e3c4118a35fc5e3dc535b69d2d61c2556c5c68034e33f6a
BLAKE2b-256 checksum
How to use checksums
14d42829276ec065abb508740df634873ee37ef164c32b984f0e4a5e25f90faf
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.37

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