Metadata-Version: 2.4
Name: simple-eda-shoshin
Version: 0.1.0
Summary: Tiny EDA helper for pandas, with a soft-but-bold plotting theme and a radar chart.
License: MIT License
        
        Copyright (c) 2026 Joseph Lacap
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pandas>=1.5
Requires-Dist: matplotlib>=3.5
Dynamic: license-file

# 1. simple-eda-shoshin

Tiny EDA helper for pandas — a few boring, useful functions plus a
soft-but-bold plotting theme, a magnitude-shaded bar, a trend line, and a
radar chart. Charts are styled to the Evergreen & Emery *Data Visualization
Checklist* out of the box.

## 1.1. Install

```bash
pip install -e .
```

Install name: `simple-eda-shoshin`  ·  import name: `simple_eda`
(hyphens to install, underscores to import — deliberate).

**Requirements:** Python ≥ 3.9, `pandas` ≥ 1.5, `matplotlib` ≥ 3.5 (installed
automatically). One-dependency mindset: pandas in, plain objects out.

## 1.2. Use

```python
import pandas as pd
import simple_eda as eda

df = pd.read_csv("data/country.csv")

# --- core: each returns a plain object, never mutates df ---
eda.summarize(df)            # {'rows', 'columns', 'names', 'types'}
eda.missing(df)              # null counts per column, most-missing first
eda.numeric_columns(df)      # ['scaled_sci']
eda.categorical_columns(df)  # ['user_country', ...]
eda.describe_numeric(df)     # .describe() on the numeric columns
eda.duplicate_columns(df)    # {'user_region': 'user_country', ...} exact-copy columns
eda.outliers(df)             # IQR-outlier count per numeric column

# --- visuals: soft, bold, colorblind-considerate ---
eda.set_theme()                               # apply the theme, returns PALETTE
eda.missing_bars(df)                          # bar chart of missingness

ramp = eda.shades(0, n=6)                      # smooth blue ramp from PALETTE[0]
total = df.groupby("user_country")["scaled_sci"].sum()
eda.top_bar(total, n=15, color=ramp, value_labels=True)  # bars shaded by size

eda.line(series, title="Trend over time")      # line graph for trends
eda.radar(["US", "GB", "FR"], {"Mexico": [4.6, 2.4, 2.5]})  # spider chart
```

## 1.3. The library

| Function | Returns | Does |
|---|---|---|
| `summarize(df)` | dict | rows, columns, names, dtypes |
| `missing(df)` | Series | null counts, most-missing first |
| `numeric_columns(df)` | list | numeric column names |
| `categorical_columns(df)` | list | text/categorical column names |
| `describe_numeric(df)` | DataFrame | `.describe()` on numeric columns |
| `duplicate_columns(df)` | dict | columns that exactly copy an earlier one, `{duplicate: original}` |
| `outliers(df, k=1.5)` | Series | IQR-outlier count per numeric column |
| `set_theme()` | list | applies the soft-bold theme; returns the palette |
| `shades(color, n)` | list | smooth light→dark ramp from one base color |
| `missing_bars(df)` | Axes | horizontal bars of missingness |
| `top_bar(series, n)` | Axes | top-N bar (accepts a `shades` ramp + `value_labels`) |
| `line(data, x, y)` | Axes | line graph for trends over an ordered axis |
| `radar(labels, series)` | Axes | radar/spider chart, one polygon per series |

`core.py` holds the data functions; `viz.py` holds the plotting. Every
function does one job, takes plain input, and returns a plain object.

## 1.4. Design: built to the Data Visualization Checklist

The theme and chart helpers bake in the Evergreen & Emery checklist so you
don't have to hand-tune each figure:

- **Text** — titles are left-justified in the upper-left (`set_theme`), sized
  hierarchically (title > labels > axis), and horizontal. `top_bar(value_labels=True)`
  labels data **directly** instead of relying on a legend.
- **Arrangement** — bars are ordered largest→smallest, axes are 2-D with
  equidistant intervals, and there is no chartjunk or decoration.
- **Color** — an intentional, **colorblind-considerate** 8-hue palette (assigned
  in fixed order, never cycled); `shades()` gives a single-hue light→dark ramp
  for encoding magnitude, which also stays legible in grayscale.
- **Lines** — gridlines are faint gray, the top/right borders are removed, and
  bar charts drop their unnecessary category tick marks.
- **Overall** — one horizontal + one vertical axis (never a second y-axis), and
  each chart type fits its data (bar = magnitude, line = change, radar = profile).

## 1.5. Example: the Social Connectedness Index

`notebooks/sci_analysis.py` runs the whole library over `data/country.csv`
(country-to-country Facebook connectedness) and writes **four** figures to
`reports/figures/`:

```bash
python notebooks/sci_analysis.py
```

- `missing.png` — where the blank rows are
- `top_connected.png` — total SCI per country, bars shaded by magnitude with
  direct labels (small diaspora nations lead, because SCI is population-normalized)
- `hub_profiles_line.png` — each country's connectedness across major hubs, as a
  line trend
- `radar_profiles.png` — the same profiles as a fingerprint: Mexico → US,
  Nigeria & Pakistan → UK, Pakistan → India (migration and colonial ties)

There's also `notebooks/eda_demo.ipynb` — the same walk-through as a notebook,
covering every function cell by cell. Select the **`.venv (3.13.9)`** kernel,
then **Run All**.

## 1.6. Versioning

Semantic versioning (`MAJOR.MINOR.PATCH`). Currently `0.1.0` — the first
working version.

## 1.7. License

[MIT](LICENSE) — do what you like; keep the copyright notice.
