Metadata-Version: 2.4
Name: pyanalytica
Version: 0.2.0
Summary: A Python analytics workbench for teaching data science
Project-URL: Homepage, https://github.com/social-engineer-ai/PyAnalytica
Project-URL: Repository, https://github.com/social-engineer-ai/PyAnalytica
Project-URL: Issues, https://github.com/social-engineer-ai/PyAnalytica/issues
Author: Ashish Khandelwal
License-Expression: MIT
License-File: LICENSE
Keywords: analytics,data-science,education,shiny,statistics
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Education
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Education
Classifier: Topic :: Scientific/Engineering
Requires-Python: >=3.10
Requires-Dist: htmltools>=0.5
Requires-Dist: matplotlib>=3.7
Requires-Dist: numpy>=1.24
Requires-Dist: pandas>=2.0
Requires-Dist: pyyaml>=6.0
Requires-Dist: scikit-learn>=1.3
Requires-Dist: scipy>=1.10
Requires-Dist: seaborn>=0.12
Requires-Dist: shiny>=1.0
Provides-Extra: ai
Requires-Dist: anthropic>=0.20; extra == 'ai'
Provides-Extra: all
Requires-Dist: anthropic>=0.20; extra == 'all'
Requires-Dist: nbformat>=5.9; extra == 'all'
Provides-Extra: dev
Requires-Dist: playwright>=1.40; extra == 'dev'
Requires-Dist: pytest-cov>=4.0; extra == 'dev'
Requires-Dist: pytest>=7.0; extra == 'dev'
Provides-Extra: report
Requires-Dist: nbformat>=5.9; extra == 'report'
Description-Content-Type: text/markdown

# PyAnalytica

A Python analytics workbench for teaching data science. Built on Shiny for Python.

## Features

- **Interactive data exploration and visualization** — profile, transform, pivot, crosstab
- **Guided statistical analysis** — group means, proportions, correlation, chi-squared
- **Machine learning** — regression, classification, model evaluation, prediction
- **AI-powered insights** — optional Anthropic integration for interpretation, suggestions, and natural-language queries
- **Homework framework** — YAML-based assignments with hash-checked grading for instructors
- **Report generation** — export analyses as HTML, Python scripts, or Jupyter notebooks
- **Procedure builder** — record, replay, and export multi-step analysis workflows
- **Bundled datasets** — ready-to-use data for classroom exercises

## Installation

```bash
pip install pyanalytica
```

Optional extras:

```bash
pip install pyanalytica[ai]      # Anthropic AI integration
pip install pyanalytica[report]  # Jupyter notebook export
pip install pyanalytica[all]     # Everything
pip install pyanalytica[dev]     # Development and testing
```

## Quick Start

### Launch the interactive workbench

```bash
pyanalytica                # CLI entry point
python -m pyanalytica      # or as a module
```

### Use as a Python library

Every analytics function returns a `(result, CodeSnippet)` tuple. The `CodeSnippet`
contains the equivalent pandas/sklearn code so students can see what runs under the hood.

```python
from pyanalytica.data.load import load_bundled
from pyanalytica.data.profile import profile_dataframe
from pyanalytica.visualize.distribute import histogram
from pyanalytica.visualize.relate import scatter
from pyanalytica.explore.summarize import group_summarize

# Load a bundled dataset
df, code = load_bundled("tips")

# Profile the dataframe
profile = profile_dataframe(df)

# Visualize
fig, code = histogram(df, "total_bill", bins=20)
fig, code = scatter(df, x="total_bill", y="tip", color_by="smoker")

# Summarize
result, code = group_summarize(df, group_cols=["day"], agg_col="tip", agg_func="mean")
```

## Bundled Datasets

| Name | Rows | Description |
|------|------|-------------|
| `tips` | 244 | Restaurant tipping data |
| `diamonds` | ~54,000 | Prices and attributes of diamonds |
| `candidates` | 5,000 | JobMatch recruiting simulation — job candidates |
| `jobs` | 500 | JobMatch recruiting simulation — job postings |
| `companies` | 200 | JobMatch recruiting simulation — companies |
| `events` | — | JobMatch recruiting simulation — recruiting events |

```python
from pyanalytica.datasets import list_datasets, load_dataset

list_datasets()          # ['candidates', 'companies', 'diamonds', 'events', 'jobs', 'tips']
df = load_dataset("diamonds")
```

## Development

```bash
git clone https://github.com/social-engineer-ai/PyAnalytica.git
cd PyAnalytica
pip install -e ".[dev,all]"
python -m pytest tests/ -v
```

## License

MIT License. See [LICENSE](LICENSE) for details.
