Skip to main content

One import, one line — the percentage and stats functions you actually need.

Project description

Percentify

PyPI Downloads PyPI version Python Versions License Build Status

Percentify is a one import, one line code, that covers all stats you need for your data analysis and codebase.

Stop digging through scipy, statsmodels, and sklearn for operations you run every day. Percentify surfaces the most common percentage and statistical calculations into simple, readable function calls.


📦 Installation

pip install percentify

✨ Core Percentage Toolkit

percent: Part of a Whole

from percentify import percent

percent(50, 200)          # → 25.0
percent(1, 3)             # → 33.33
percent(5, 0)             # → 0.0  (safe division by zero)

change: Percentage Increase or Decrease

from percentify import change

change(100, 150)  # → 50.0   (50% increase)
change(200, 150)  # → -25.0  (25% decrease)

difference: Difference Between Two Values

from percentify import difference

difference(10, 20)  # → 66.67
difference(50, 50)  # → 0.0

split: Split a Total by Weights

from percentify import split

split(200, [1, 3])       # → [50.0, 150.0]
split(100, [1, 1, 1])    # → [33.33, 33.33, 33.33]

display: Format as a String

from percentify import display

display(25.0)                         # → "25.0%"
display(0.45, multiply=True)          # → "45.0%"
display(change(100, 20))              # → "-80.0%"

Example Use Case

Screenshot

📊 Beyond Percentages; Data Science & Analytics

The functions below replace multi-step, hard-to-remember imports from scipy, statsmodels, and sklearn with a single line.

vif: Variance Inflation Factor (MultiCollinearity)

Currently buried in statsmodels.stats.outliers_influence. One line instead of six.

from percentify import vif

vif(df)
# → {"age": 1.2, "income": 8.4, "debt": 7.9}

vif(df, flag=5.0)
# → only columns with VIF > 5 (multicollinearity warnings)

missing: Easy Missing Data Profiling

No more typing df.isnull().sum() / len(df) * 100 every time.

from percentify import missing

missing(df)
# → {"salary": 12.4, "age": 3.1, "name": 0.0}

cv: Coefficient of Variation

Not built-in anywhere — one line instead of df.std() / df.mean() * 100.

from percentify import cv

cv(df["salary"])  # → 34.2
cv(df)            # → all numeric columns at once

outliers: Percentage of Outliers (IQR Method)

Stop rewriting the IQR calculation from scratch.

from percentify import outliers

outliers(df["salary"])  # → 4.7
outliers(df)            # → all numeric columns

r_squared: R-Squared

from percentify import r_squared

r_squared(y_true, y_pred)  # → 87.3

variance_explained: PCA Variance Breakdown

from percentify import variance_explained

variance_explained(df)
# → {"PC1": 45.2, "PC2": 23.1, "PC3": 12.8}

🤝 Contributing

Contributions are welcome!

  • If you have an idea (extra helpers, bug fixes or an idea):
  • Fork this repo
  • Create a branch
  • Commit your changes
  • Open a pull request

I try to keep it within scope, to discuss big new features first.

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

percentify-0.4.0.tar.gz (13.1 kB view details)

Uploaded Source

Built Distribution

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

percentify-0.4.0-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file percentify-0.4.0.tar.gz.

File metadata

  • Download URL: percentify-0.4.0.tar.gz
  • Upload date:
  • Size: 13.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.8

File hashes

Hashes for percentify-0.4.0.tar.gz
Algorithm Hash digest
SHA256 25e85ded12756efe530693e8974d930c46cbc7d10dbf4a7a313a8bec1bcb251f
MD5 7449461812c8449a285cc1bbf07aac52
BLAKE2b-256 d2fb043d2526d9ebd7aad5b4fae01f1a8bf54c045d1c798826d301fe58493070

See more details on using hashes here.

File details

Details for the file percentify-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: percentify-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 11.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.8

File hashes

Hashes for percentify-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bec2310ed6265f7db067975f791b719872bcc6f073fa4f8dfe85c8cdabb1885e
MD5 4be34c7e9087b506a0e1b3f98655b92b
BLAKE2b-256 a76956465f700598e6052108e17271fb534a7fd11417babe861179848aa0eb25

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