(Super simple) Summarisation and Plotting - sumnplot
Project description
(Super simple) Summarisation and Plotting
Introduction
sumplot provides some very simple functionality to discretise, summarise and plot variables.
The example below uses the diabetes data and will summarise the variables s1, s2 and s3 by age and bmi which are both discretised according to specific quantiles.
from sklearn.datasets import load_diabetes
from sumnplot.discretisation import QuantileDiscretiser
from sumnplot.summary import ColumnSummariser
from sumnplot.plot.matplotlib import plot_summarised_variable_2way
X, y = load_diabetes(return_X_y=True, as_frame=True)
X["s1"] = X["s1"] - X["s1"].min()
two_way_summary = ColumnSummariser._summarise_column(
df=X,
to_summarise_columns=["s1", "s2", "s3"],
to_summarise_columns_labels=["obs", "p1", "p2"],
to_summarise_divide_column="s1",
by_column=QuantileDiscretiser(
variable="age", quantiles=(0, 0.25, 0.5, 0.75, 1.0)
),
second_by_column=QuantileDiscretiser(
variable="bmi", quantiles=(0, 0.33, 0.66, 1.0)
),
)
plot_summarised_variable_2way(
two_way_summary,
axis_right=0,
axis_left=[1, 2],
bar_type="stacked",
bars_percent=True,
)
Install
The easiest way to get sumnplot is directly from pypi using;
pip install sumnplot
Documentation
Documentation can be found at readthedocs.
For information on how to build the documentation locally see the docs README.
Examples
There are various example notebooks demonstrating how to use the package in the demo folder in the repo.
To open the example notebooks in binder click here or click on the launch binder shield above and then click on the directory button in the side bar to the left to navigate to the specific notebook.
Build
sumnplot uses flit as the package build tool.
To install sumnplot for development, use the following commands from the root directory;
pip install "flit>=3.2,<4"
flit install
The default deps flag for flit is all so this will install all of the libraries required for testing and creating the docs.
To install sumnplot in editable mode (i.e. the equivalent of pip install . -e) use the symlink flag;
flit install --symlink
See the flit docs for all the command line options for flit.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sumnplot-0.3.0.tar.gz.
File metadata
- Download URL: sumnplot-0.3.0.tar.gz
- Upload date:
- Size: 18.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.27.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a7242b93e9a9a7de81f36bb5050c8ec5f09fc4fbbc8a1e553c8d654da0f95b80
|
|
| MD5 |
2f85aa6d45bcd8792d4b0b659ac1bc21
|
|
| BLAKE2b-256 |
ae0bf6d13d76b6189e926ed65e213d44a79a131a02a24eafe8fde3fa38e4f032
|
File details
Details for the file sumnplot-0.3.0-py3-none-any.whl.
File metadata
- Download URL: sumnplot-0.3.0-py3-none-any.whl
- Upload date:
- Size: 16.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.27.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a787099e7aa712fe90e1133d7d35e0fc18463fcc7aacb0345f0c7c94ee01e399
|
|
| MD5 |
72313dce9341281961ff3a34146f3484
|
|
| BLAKE2b-256 |
b31f5e565594c8d468975cf756795de9fbe8dcae77803f884347e8062be5e688
|