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

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.40
File Size Uploaded Provenance
stats_compass_core-0.1.40.tar.gz 392.1 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 857.7 kB

Release files / stats_compass_core-0.1.40.tar.gz

Download URL stats_compass_core-0.1.40.tar.gz
Size 392.1 kB
Tags Source
SHA-256 checksum
How to use checksums
484a1b383dbb3663a344d74422b37c6dacbe3a289c877e6826bbc4633dc76a24
BLAKE2b-256 checksum
How to use checksums
52bea54e64d55794e85de4eb97aaacdfc92c0c485189963aa4569c4aaa18b4d2
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.40-py3-none-any.whl

Download URL stats_compass_core-0.1.40-py3-none-any.whl
Size 465.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bdef1d6ff9f52360a3fa1da9b0a616745753d4474a4880014de274f6b60ed3d1
BLAKE2b-256 checksum
How to use checksums
8e482cd6508df0b5a8e982189cb14585a9a2129c821f3864215d17b110abf0f0
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.40

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