Skip to main content

(Super simple) Summarisation and Plotting

PyPI Read the Docs GitHub GitHub last commit

Introduction

sumplot provides some very simple functionality to discretise, summarise and plot data.

The example below uses the diabetes dataset and summarises the variables s1, s2 and s3 by bp. The bp variable is discretised into buckets with a minimum of 5% of weight per bucket.

import polars as pl
from sklearn.datasets import load_diabetes

from sumnplot.discretisation import EqualWeightDiscretiser
from sumnplot.summarisation import group_by_weighted_average, ResponseWeight
from sumnplot.plot.altair.one_way_summary import produce_one_way_summary_plot

X, _ = load_diabetes(return_X_y=True, as_frame=True)
df = pl.DataFrame(X).with_columns(pl.lit(1).alias("w"))

bp_discretiser = EqualWeightDiscretiser(
    column="bp",
    weights="w",
    min_weight_proportion=0.05,
    round_breaks_for_labels=True,
)
bp_discretiser.fit(df)
df = bp_discretiser.transform(df)

results = group_by_weighted_average(
    df,
    groupby_columns=["bp"],
    responses=[ResponseWeight("s1", "w"), ResponseWeight("s2", "w"), ResponseWeight("s3", "w")],
)

chart = produce_one_way_summary_plot(
    results,
    x_axis_column="bp",
    left_y_axis_column="w",
    right_y_axis_columns=["s1", "s2", "s3"],
    title="One Way Summary by 'bp'",
    x_axis_label_angle=90,
)

chart

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.

Build

sumnplot uses uv as the project management tool.

To install sumnplot for development, first install uv then run the following from the project root:

uv sync

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sumnplot-0.5.0.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

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

sumnplot-0.5.0-py3-none-any.whl (21.0 kB view details)

Uploaded Python 3

File details

Details for the file sumnplot-0.5.0.tar.gz.

File metadata

  • Download URL: sumnplot-0.5.0.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.5

File hashes

Hashes for sumnplot-0.5.0.tar.gz
Algorithm Hash digest
SHA256 8aba79033d3a7e82c8c7a9d172614beb0a6a0eea1aabb1fffb76124ffb8de67d
MD5 0ba752b1401aac1be12ac5041b65424a
BLAKE2b-256 87c04074dca79f51a4bdc75fb30b0b0df2cab30e59d9419b42e4c202517543c6

See more details on using hashes here.

File details

Details for the file sumnplot-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: sumnplot-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 21.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.5

File hashes

Hashes for sumnplot-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4a293e5ea7601007ce559019740b7fd90a535e4108e08c911a29c89fec0f213b
MD5 88fa2be2d24d6935ff198fd92fb52815
BLAKE2b-256 25fb5de5859465edc89a086c629a119f1d750da2e57e2f94a423ea89d3f8925a

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 files

0.3.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page