Skip to main content

A clean toolkit of deterministic pandas-based data tools

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stats_compass_core-0.1.22.tar.gz (329.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stats_compass_core-0.1.22-py3-none-any.whl (389.5 kB view details)

Uploaded Python 3

File details

Details for the file stats_compass_core-0.1.22.tar.gz.

File metadata

  • Download URL: stats_compass_core-0.1.22.tar.gz
  • Upload date:
  • Size: 329.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.12.5 Darwin/24.6.0

File hashes

Hashes for stats_compass_core-0.1.22.tar.gz
Algorithm Hash digest
SHA256 d6ca0d6a02b14833b8deb5f8d9f774e9c7bfba89967a1e6f5bd1e8e68d2c5da4
MD5 7c2380de3c1f5a75e5e42399a3b4ab71
BLAKE2b-256 5e61cbcd08299978ebf0f980e68d5b3a96eb3cf5f15f9cb3c219ba322950e6ac

See more details on using hashes here.

File details

Details for the file stats_compass_core-0.1.22-py3-none-any.whl.

File metadata

File hashes

Hashes for stats_compass_core-0.1.22-py3-none-any.whl
Algorithm Hash digest
SHA256 a305cd4aefa2e8cd5c509da7e2a98333b2a9a50523b7f3c180faef6234634b1f
MD5 0828308988fcb5d304d64da5b731930e
BLAKE2b-256 6b35842af448829c2896921293a7cdbb4a696a61045ac9707d4e6364c13387aa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page