Skip to content

Commit 5e342b7

Browse files
authored
Merge pull request #1 from data-centt/main
Rerun
2 parents 9326516 + 1b99971 commit 5e342b7

14 files changed

Lines changed: 1856 additions & 295 deletions

File tree

.github/workflows/docs.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Deploy Docs
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
7+
permissions:
8+
contents: write
9+
10+
jobs:
11+
deploy:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Configure Git Credentials
17+
run: |
18+
git config user.name "github-actions[bot]"
19+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
20+
21+
- uses: actions/setup-python@v5
22+
with:
23+
python-version: "3.x"
24+
25+
- name: Cache MkDocs build
26+
uses: actions/cache@v4
27+
with:
28+
key: mkdocs-material-${{ github.sha }}
29+
path: .cache
30+
restore-keys: |
31+
mkdocs-material-
32+
33+
- name: Install docs dependencies
34+
run: pip install mkdocs-material
35+
36+
- name: Build and deploy to gh-pages
37+
run: mkdocs gh-deploy --force

README.md

Lines changed: 56 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,92 +1,88 @@
1-
# % Percentify %
2-
[![PyPI Downloads](https://static.pepy.tech/personalized-badge/percentify?period=total&units=INTERNATIONAL_SYSTEM&left_color=BLACK&right_color=GREEN&left_text=downloads)](https://pepy.tech/projects/percentify)
1+
2+
<p align="center">
3+
<img src="asset/Logo.png" alt="Percentify logo" height="52">
4+
</p>
5+
6+
[![Downloads](https://static.pepy.tech/badge/percentify)](https://pepy.tech/project/percentify)
37
[![PyPI version](https://img.shields.io/pypi/v/percentify.svg?style=flat&color=blue)](https://pypi.org/project/percentify/)
48
[![Python Versions](https://img.shields.io/pypi/pyversions/percentify.svg?style=flat&color=green)](https://pypi.org/project/percentify/)
59
[![License](https://img.shields.io/pypi/l/percentify.svg?style=flat&color=orange)](LICENSE)
10+
[![Docs](https://img.shields.io/badge/docs-percentify-14b8a6)](https://data-centt.github.io/percentify/)
611
[![Build Status](https://github.com/data-centt/percentify/actions/workflows/python-app.yml/badge.svg)](https://github.com/data-centt/percentify/actions/workflows/python-app.yml)
712

8-
**Percentify** is a Python helper that turns *"part of a whole"* into a clean percentage.
9-
Stop typing `(part / whole) * 100` and worrying about division by zero.
10-
11-
---
12-
13-
## ✨ What It Does
14-
15-
A zero-dependency Python toolkit for all things percentages:
13+
**Percentify is a data science library that turns the 20% of data science operations behind 80% of daily work into single, readable function calls.**
1614

1715

18-
- **`percent`** — what percentage is `part` of `whole`?
19-
- **`percent_change`** — how much did a value increase or decrease?
20-
- **`percent_diff`** — how far apart are two values?
21-
- **`percent_distribute`** — split a total into weighted shares.
22-
- **`percent_format`** — turn any number into a clean `"25.0%"` string.
16+
Built on pandas and numpy, it pairs everyday hard to reach tools with lesser-known ones. Where a function wraps an existing library (pandas, scipy, statsmodels, scikit-learn), it names it, so you always know where to dig deeper.
2317

24-
All functions handle edge cases (division by zero, negative values) safely and let you control decimal precision.
25-
=======
26-
- Calculates what percentage one number is of another.
27-
- Handles divide-by-zero safely (returns 0.0 instead of crashing).
28-
- Lets you choose how many decimal places you want to round your answer to.
29-
- Has zero dependencies — just pure Python.
18+
## 📖 Documentation
3019

20+
**Full guide, every function, and live examples → [data-centt.github.io/percentify](https://data-centt.github.io/percentify/)**
3121

3222
## 📦 Installation
33-
```
23+
24+
```bash
3425
pip install percentify
3526
```
3627

37-
## Usage
28+
Requires `numpy` and `pandas`.
3829

39-
### `percent` — Part of a Whole
40-
```python
41-
from percentify import percent
30+
## Quick example
4231

43-
percent(50, 200) # → 25.0
44-
percent(1, 3) # → 33.33
45-
percent(5, 0) # → 0.0 (safe division by zero)
46-
percent(7, 9, 4) # → 77.7778 (custom decimals)
32+
```python
33+
import pandas as pd
34+
from percentify import missing
35+
36+
df = pd.DataFrame({
37+
"salary": [50000, None, 60000, None],
38+
"age": [25, 30, None, 40],
39+
"city": ["NY", "LA", "SF", "LA"],
40+
})
41+
42+
missing(df)
43+
# column missing_pct
44+
# 0 salary 50.0
45+
# 1 age 25.0
46+
# 2 city 0.0
4747
```
4848

49-
### `percent_change` — Increase or Decrease
50-
```python
51-
from percentify import percent_change
49+
One import, one line. A clean, sorted DataFrame you can read or feed into the next step.
5250

53-
percent_change(100, 150) # → 50.0 (50% increase)
54-
percent_change(200, 150) # → -25.0 (25% decrease)
55-
percent_change(0, 100) # → 0.0 (safe when old is zero)
56-
```
51+
## What's inside
5752

58-
### `percent_diff` — Difference Between Two Values
59-
```python
60-
from percentify import percent_diff
53+
| Function | What it answers |
54+
|---|---|
55+
| `change` | Growth as numbers, columns, or a whole series |
56+
| `vif` | Which features are collinear? |
57+
| `missing` | How much of each column is missing? |
58+
| `cv` | How variable is each column, relative to its mean? |
59+
| `outliers` | What percentage of each column are outliers? |
60+
| `r_squared` | How well do predictions fit? |
61+
| `pca_variance` | How much variance does each principal component explain? |
62+
| `difference` | How far apart are two values or columns? |
63+
| `split` | How does a total divide across weights or groups? |
64+
| `display` | Format numbers or a column as clean "%" strings |
6165

62-
percent_diff(10, 20) # → 66.67
63-
percent_diff(50, 50) # → 0.0
64-
```
66+
→ See the **[documentation](https://data-centt.github.io/percentify/)** for a worked, real-output example of every function.
6567

66-
### `percent_distribute` — Split a Total by Weights
67-
```python
68-
from percentify import percent_distribute
68+
## 🛟 Friendly by design
6969

70-
percent_distribute(200, [1, 3]) # → [50.0, 150.0]
71-
percent_distribute(100, [1, 1, 1]) # → [33.33, 33.33, 33.33]
72-
```
70+
- **No cryptic tracebacks**; Hand a function a text column where numbers are needed and you get a clear PercentifyWarning, not an Arrow/NumPy stack trace.
71+
- **Sensible defaults**; Results come back sorted worst-first, and PCA is standardized out of the box.
72+
- **DataFrames everywhere**; so the output drops straight into your notebook, your next filter, or your model.
7373

74-
### `percent_format` — Format as a String
75-
```python
76-
from percentify import percent_format
7774

78-
percent_format(25.0) # → "25.0%"
79-
percent_format(33.3333, 1) # → "33.3%"
80-
percent_format(50, suffix=" percent") # → "50.0 percent"
81-
```
75+
## 🤝 Contributing
8276

83-
# 🤝 Contributing
77+
Contributions are welcome but they must follow the repo's guiding principle:
78+
> Keep each method as direct-to-output as possible. A percentify function should return the single most common answer in one line, and point users to the underlying library (pandas, scipy, statsmodels, scikit-learn) for the full, configurable version when the simplest output isn't what they're after.
8479
85-
Contributions are welcome!
86-
- If you have an idea (extra helpers, bug fixes or an idea):
87-
- Fork this repo
80+
If your idea keeps things that simple and direct:
81+
- Open an issue first to discuss it
82+
- Fork the repo
8883
- Create a branch
8984
- Commit your changes
9085
- Open a pull request
9186

87+
> Anything that adds knobs and options for their own sake, or duplicates what the parent libraries already do well, is out of scope; those cases should point to the source library instead.
9288
I try to keep it compact on purpose, to discuss big new features first.

asset/favicon.png

1.36 MB
Loading

asset/log.png

2.05 MB
Loading

asset/testcase.jpeg

81.2 KB
Loading

0 commit comments

Comments
 (0)