pdpatch
pdpatch adds methods to pandas’
DataFrame and Series for a faster data science pipeline. It also
defines drop-in replacements for seaborn and plotly.express that
automatically label axes with nicer titles. We use
nbdev to build this project.
Install
pip install pdpatch
How to use
from pdpatch.all import *
Interactive Method .less()
Automatically Rename snake_case columns in plotly.express and seaborn
import pandas as pd
from pdpatch.express import *
df = pd.DataFrame({'time__s__': range(10), 'position__m__': [i**1.3 for i in range(10)], 'speed__m/s__': 10*[1]})
#df = pd.DataFrame({'time__s__': range(10), 'position__m__': range(10)})
px.scatter(df, x='time__s__', y='position__m__').show('png')
from pdpatch.seaborn import sns
sns.scatterplot(data=df, x='time__s__', y='position__m__');
Add Altair-like Operation to plotly Figures
fig = px.scatter(df,x='time__s__', y='time__s__') | px.scatter(df,x='time__s__', y=['position__m__', 'speed__m/s__'])
fig.show('png')
fig = px.scatter(df,x='time__s__', y='time__s__') / px.scatter(df,x='time__s__', y=['position__m__', 'speed__m/s__'])
fig.show('png')
fig = px.scatter(df,x='time__s__', y='time__s__') | px.scatter(df,x='time__s__', y=['position__m__', 'speed__m/s__'])
(fig / fig).show('png')
Shorter methods
df.rename(columns={'col_1': 'new_name'})->df.renamec('col_1', 'new_name')
df = dummydf()
df.renamec('col_1', 'new_name').to_html()
| new_name | col_2 | |
|---|---|---|
| 0 | 100 | a |
| 1 | 101 | b |
| 2 | 102 | c |
| 3 | 103 | d |
| 4 | 104 | e |
Functions as methods
df.len()
5
New methods
df.col_1.minmax
(100, 104)
Utility functions
df = dummydf()
df.to_html()
| col_1 | col_2 | |
|---|---|---|
| 0 | 100 | a |
| 1 | 101 | b |
| 2 | 102 | c |
| 3 | 103 | d |
| 4 | 104 | e |
Metadata
Release files for pdpatch 0.1.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pdpatch-0.1.9.tar.gz | 13.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pdpatch-0.1.9-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 26.7 kB
Release files / pdpatch-0.1.9.tar.gz
| Download URL | pdpatch-0.1.9.tar.gz |
|---|---|
| Size | 13.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
57ebc054199f2ed2fb075948ce994e5a1f977740d2ac07cbebd8198b0a6828e1
|
|
BLAKE2b-256 checksum How to use checksums |
497779557987a6bc0526109b73cbc14fa46a5053675fe7519447c8e9626b7eda
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.9
|
Release files / pdpatch-0.1.9-py3-none-any.whl
| Download URL | pdpatch-0.1.9-py3-none-any.whl |
|---|---|
| Size | 12.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3ec9644c368223b6dfac192cd0f5d701207006ebdd17e8186fd560149a09bd8d
|
|
BLAKE2b-256 checksum How to use checksums |
fb5b20ad50584f69372f6f87185fec9a0c315c939bec5ac4006ba00ec5b18d18
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.9
|