Skip to main content

Faster, easier, more robust python data analysis

Project description

py-utilz

Build Status Coverage Status Python Versions Platforms

Convenient helper functions, decorators, and data analysis tools to make life easier with minimal dependencies:

pip install py-utilz

dplyr like data grammar:

from utilz import pipe
import utilz.dfverbs as _

out = pipe(
    df,
    _.rename({"weight (male, lbs)": "male", "weight (female, lbs)": "female"}),
    _.pivot_longer(columns=["male", "female"], into=("sex", "weight")),
    _.split("weight", ("min", "max"), sep="-"),
    _.pivot_longer(columns=["min", "max"], into=("stat", "weight")),
    _.astype({"weight": float}),
    _.groupby("genus", "sex"),
    _.mutate(weight="weight.mean()"),
    _.pivot_wider(column="sex", using="weight"),
    _.mutate(dimorphism="male / female")
)
from utilz import map

# Combine function results into a list, array, or dataframe
map(myfunc, myiterable)

# Syntactic sugar for joblib.Parallel
map(myfunc, myiterable, n_jobs=4)
from utilz import log, maybe

# Print the shape of args and outputs before and after execute
@log
def myfunc(args):
    return out

# Only run myfunc if results.csv doesn't eist
@maybe
def myfunc(args, out_file=None):
    return out

myfunc(args, out_file='results.csv')

Development

  1. Install poetry: curl -sSL https://install.python-poetry.org | python
  2. Setup virtual environment poetry install --with dev
  3. Run all tests: poetry run pytest
  4. Live render docs: poetry run mkdocs serve

Additional poetry/virtual environment commands

  • Activate environment in current shell: source activate .venv/bin/activate
  • Activate environment in sub-process shell: poetry shell
  • Add/remove additional packages: poetry add/remove package_name
  • Build local package: poetry build
  • Deploy to pypi: poetry publish (requires auth)

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

py_utilz-0.4.1.tar.gz (44.9 kB view details)

Uploaded Source

Built Distribution

py_utilz-0.4.1-py3-none-any.whl (54.5 kB view details)

Uploaded Python 3

File details

Details for the file py_utilz-0.4.1.tar.gz.

File metadata

  • Download URL: py_utilz-0.4.1.tar.gz
  • Upload date:
  • Size: 44.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for py_utilz-0.4.1.tar.gz
Algorithm Hash digest
SHA256 71fbbbe37379b532a2eb2d018807c5dba6dee1f523e154b6c63cbb7d3abd92cb
MD5 1802994321c9854a0ad98ebcdfef9a23
BLAKE2b-256 01721b30014b270c2f5d8b0facb85357971bc0c86ec2ef7c14363c0817dfae39

See more details on using hashes here.

File details

Details for the file py_utilz-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: py_utilz-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 54.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for py_utilz-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d5c84943893012a5551e9de41cf752e46b8e5ebab16b5102dd04f553e90470d5
MD5 31d3e213a6d248a8e0575da5cce3df15
BLAKE2b-256 bb24a79f1212100e9db17c42f2ebc09eeb9f24bd562e5fad21d41fd4aeefb415

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page