Skip to main content

A collection of helper for table handling and vizualization

Project description

pandas-plots

PyPI - Version GitHub last commit GitHub License py3.10

usage

install / update package

pip install pandas-plots -U

include in python

from pandas_plots import tbl, pls, ven, hlp, pii

example

# load sample dataset from seaborn
import seaborn as sb
df = sb.load_dataset('taxis')
_df = df[["passengers", "distance", "fare"]][:5]
tbl.show_num_df(
    _df,
    total_axis="xy",
    total_mode="mean",
    data_bar_axis="xy",
    pct_axis="xy",
    precision=0,
    kpi_mode="max_min_x",
    kpi_rag_list=(1,7),
)

show_num

why use pandas-plots

pandas-plots is a package to help you examine and visualize data that are organized in a pandas DataFrame. It provides a high level api to pandas / plotly with some selected functions and predefined options:

  • tbl utilities for table descriptions

    • 🌟show_num_df() displays a table as styled version with additional information
    • describe_df() an alternative version of pandas describe() function
    • pivot_df() gets a pivot table of a 3 column dataframe (or 2 columns if no weights are given)
  • pls for plotly visualizations

    • plot_box() auto annotated boxplot w/ violin option
    • plot_boxes() multiple boxplots (annotation is experimental)
    • plot_stacked_bars() shortcut to stacked bars 😄
    • plots_bars() a standardized bar plot for a categorical column
      • features confidence intervals via use_ci option
    • plot_histogram() histogram for one or more numerical columns
    • plot_joints() a joint plot for exactly two numerical columns
    • plot_quadrants() quickly shows a 2x2 heatmap
  • ven offers functions for venn diagrams

    • show_venn2() displays a venn diagram for 2 sets
    • show_venn3() displays a venn diagram for 3 sets
  • hlp contains some (variety) helper functions

    • df_to_series() converts a dataframe to a series
    • mean_confidence_interval() calculates mean and confidence interval for a series
    • wrap_text() formats strings or lists to a given width to fit nicely on the screen
    • replace_delimiter_outside_quotes() when manual import of csv files is needed: replaces delimiters only outside of quotes
    • create_barcode_from_url() creates a barcode from a given URL
    • add_datetime_col() adds a datetime columns to a dataframe
    • show_package_version prints version of a list of packages
    • get_os helps to identify and ensure operating system at runtime
  • pii has routines for handling of personally identifiable information

    • remove_pii() logs and deletes pii from a series

note: theme setting can be controlled through all functions by setting the environment variable THEME to either light or dark

more examples

pls.plot_box(df['fare'], height=400, violin=True)

plot_box

# quick and exhaustive description of any table
tbl.describe_df(df, 'taxis', top_n_uniques=5)

describe_df

# show bars with confidence intervals
_df = df[["payment", "fare"]]
pls.plot_bars(
    _df,
    dropna=False,
    use_ci=True,
    height=600,
    width=800,
    precision=1,
)

bars_with_ci

# show venn diagram for 3 sets
from pandas_plots import ven

set_a = {'ford','ferrari','mercedes', 'bmw'}
set_b = {'opel','bmw','bentley','audi'}
set_c = {'ferrari','bmw','chrysler','renault','peugeot','fiat'}
_df, _details = ven.show_venn3(
    title="taxis",
    a_set=set_a,
    a_label="cars1",
    b_set=set_b,
    b_label="cars2",
    c_set=set_c,
    c_label="cars3",
    verbose=0,
    size=8,
)

venn

tags

#pandas, #plotly, #visualizations, #statistics

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

pandas_plots-0.11.11.tar.gz (29.8 kB view details)

Uploaded Source

Built Distribution

pandas_plots-0.11.11-py3-none-any.whl (28.3 kB view details)

Uploaded Python 3

File details

Details for the file pandas_plots-0.11.11.tar.gz.

File metadata

  • Download URL: pandas_plots-0.11.11.tar.gz
  • Upload date:
  • Size: 29.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for pandas_plots-0.11.11.tar.gz
Algorithm Hash digest
SHA256 ccec6e8e30b04a0191df45cbc71829819eb19424222ecf3672e2f135a92a5e91
MD5 2e9ab588c8eb58f9d91659ee2ee05c2f
BLAKE2b-256 1e5c41a2c8ab090ca5c6be98a3809c81687a0b16cc0c5fe7a7a99a3c3cefd446

See more details on using hashes here.

File details

Details for the file pandas_plots-0.11.11-py3-none-any.whl.

File metadata

File hashes

Hashes for pandas_plots-0.11.11-py3-none-any.whl
Algorithm Hash digest
SHA256 51b46f37e7bcda2ac85a54e24a507c3b56d962407323a79ecd84af27577432b0
MD5 a513148f2c1c4e04d7f784acb1d124d9
BLAKE2b-256 2f8ccdd78a6e0deb2b269c5e8fde820e83751c53704bb5e755c9f3d477154467

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