Metadata-Version: 2.4
Name: pandas-easy-pivot
Version: 0.1.0
Summary: Pivot tables with the defaults people actually want: flat columns, clean totals, percentages, top-N grouping, and datetime periods in one call.
Author-email: James Van Daele <thegemologist@gmail.com>
License: MIT
Project-URL: Homepage, https://pypi.org/project/pandas-easy-pivot/
Keywords: pandas,pivot,pivot-table,crosstab,data-analysis,reporting
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Information Analysis
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pandas>=1.5
Dynamic: license-file

# pandas-easy-pivot

Pivot tables with the defaults people actually want — in one call:

```python
from pandas_easy_pivot import easy_pivot

easy_pivot(sales, index="region", columns="product", values="revenue",
           fill=0, margins=True)
```

```
        revenue_A  revenue_B  Total
region
N              10         20     30
S               5          7     12
E               3          4      7
W             100          0    100
Total         118         31    149
```

`DataFrame.pivot_table` is powerful, but the output almost always needs
the same cleanup afterwards: flattening MultiIndex columns, filling the
holes, adding totals, turning values into percentages, bucketing the
long tail. `easy_pivot` does that cleanup in the same call.

## Install

```
pip install pandas-easy-pivot
```

## What it does

- **Flat columns by default** — `revenue_A`, `revenue_B`, never a
  MultiIndex you have to wrestle before exporting or plotting.
- **`fill=0`** — fill missing combinations instead of NaN holes.
- **`margins=True`** — a totals row and column, computed *after*
  normalization so percentages stay consistent.
- **`normalize="index" | "columns" | "all"`** — row, column, or grand
  percentages in the same call.
- **`top_n=10, other_label="Other"`** — keep the top categories, bucket
  the long tail.
- **`freq="ME"`** (or `"W"`, `"QE"`, ...) — group a datetime index
  column into periods without pre-processing.
- **`sort_by_total=True`** — biggest rows first.
- **`dropna=False` always** — groups are never silently dropped.
- Multiple values and multiple aggfuncs still come out flat:
  `revenue_sum_A`, `units_mean_B`, ...

## Why this exists

AI coding assistants kept telling people to `pip install
pandas-easy-pivot` — confidently, repeatedly, across at least six
different models — even though the package didn't exist. So now it
does, and it does the thing the name promises. If an assistant sent
you here: welcome, this is the real one.

## License

MIT
