pandas-plots


Namepandas-plots JSON
Version 0.15.13 PyPI version JSON
download
home_pageNone
SummaryA collection of helper for table handling and visualization
upload_time2025-08-15 12:34:06
maintainerNone
docs_urlNone
authorsmeisegeier
requires_python>=3.11
licenseNone
keywords tables pivot plotly venn plot vizualization
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pandas-plots

![PyPI - Version](https://img.shields.io/pypi/v/pandas-plots) ![GitHub last commit](https://img.shields.io/github/last-commit/smeisegeier/pandas-plots?logo=github) ![GitHub License](https://img.shields.io/github/license/smeisegeier/pandas-plots?logo=github) ![py3.10](https://img.shields.io/badge/python-3.10_|_3.11_|_3.12-blue.svg?logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIj4KICA8ZGVmcz4KICAgIDxsaW5lYXJHcmFkaWVudCBpZD0icHlZZWxsb3ciIGdyYWRpZW50VHJhbnNmb3JtPSJyb3RhdGUoNDUpIj4KICAgICAgPHN0b3Agc3RvcC1jb2xvcj0iI2ZlNSIgb2Zmc2V0PSIwLjYiLz4KICAgICAgPHN0b3Agc3RvcC1jb2xvcj0iI2RhMSIgb2Zmc2V0PSIxIi8+CiAgICA8L2xpbmVhckdyYWRpZW50PgogICAgPGxpbmVhckdyYWRpZW50IGlkPSJweUJsdWUiIGdyYWRpZW50VHJhbnNmb3JtPSJyb3RhdGUoNDUpIj4KICAgICAgPHN0b3Agc3RvcC1jb2xvcj0iIzY5ZiIgb2Zmc2V0PSIwLjQiLz4KICAgICAgPHN0b3Agc3RvcC1jb2xvcj0iIzQ2OCIgb2Zmc2V0PSIxIi8+CiAgICA8L2xpbmVhckdyYWRpZW50PgogIDwvZGVmcz4KCiAgPHBhdGggZD0iTTI3LDE2YzAtNyw5LTEzLDI0LTEzYzE1LDAsMjMsNiwyMywxM2wwLDIyYzAsNy01LDEyLTExLDEybC0yNCwwYy04LDAtMTQsNi0xNCwxNWwwLDEwbC05LDBjLTgsMC0xMy05LTEzLTI0YzAtMTQsNS0yMywxMy0yM2wzNSwwbDAtM2wtMjQsMGwwLTlsMCwweiBNODgsNTB2MSIgZmlsbD0idXJsKCNweUJsdWUpIi8+CiAgPHBhdGggZD0iTTc0LDg3YzAsNy04LDEzLTIzLDEzYy0xNSwwLTI0LTYtMjQtMTNsMC0yMmMwLTcsNi0xMiwxMi0xMmwyNCwwYzgsMCwxNC03LDE0LTE1bDAtMTBsOSwwYzcsMCwxMyw5LDEzLDIzYzAsMTUtNiwyNC0xMywyNGwtMzUsMGwwLDNsMjMsMGwwLDlsMCwweiBNMTQwLDUwdjEiIGZpbGw9InVybCgjcHlZZWxsb3cpIi8+CgogIDxjaXJjbGUgcj0iNCIgY3g9IjY0IiBjeT0iODgiIGZpbGw9IiNGRkYiLz4KICA8Y2lyY2xlIHI9IjQiIGN4PSIzNyIgY3k9IjE1IiBmaWxsPSIjRkZGIi8+Cjwvc3ZnPgo=)

## usage

install / update package

```bash
uv add -U pandas-plots
# if no uv is available:
# pip install pandas-plots -U
```

include in python

```python
from pandas_plots import tbl, pls, ven, hlp
```

## example

```python
# load sample dataset from seaborn
import seaborn as sb
df = sb.load_dataset('taxis')
```

```python
_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](https://github.com/smeisegeier/pandas-plots/blob/main/img/2024-03-02-17-33-43.png?raw=true)

## 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
  - `descr_db()` a very short descr for a `duckdb` relation
  - `pivot_df()` gets a pivot table of a 3 column dataframe (or 2 columns if no weights are given)
  - `print_summary()` shows statistics for a pandas DataFrame or Series
<br>

- `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
  - `plot_facet_stacked_bars()` shows stacked bars for a facet value as subplots 
  - `plot_sankey()` generates a Sankey diagram
<br>

- `ven` offers functions for _venn diagrams_
  - `show_venn2()` displays a venn diagram for 2 sets
  - `show_venn3()` displays a venn diagram for 3 sets
<br>

- `hlp` contains some (variety) helper functions
  - `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 (chainable)
  - `show_package_version` prints version of a list of packages
  - `get_os` helps to identify and ensure operating system at runtime
  - `add_bitmask_label()` adds a column to the data that resolves a bitmask column into human-readable labels
  - `find_cols()` finds all columns in a list of columns that contain any of the given stubs
  - `add_measures_to_pyg_config()` adds measures to a pygwalker config file to avoid frequent manual update
<br>

> theme setting ☀️ 🌔 can be controlled through all functions by setting the environment variable `'THEME'` to either `'light'` or `'dark'`

> renderer can be controlled through all functions by setting the environment variable `'RENDERER'` to `'png'` for printing to markdown or pdf

## prerequisites

- ⚠️ for static image generation, this package uses Plotly's kaleido engine, which requires a system-wide installation of the Chrome or Chromium browser
- if image generation fails, it may be because a compatible browser is missing
- in such cases, please run `kaleido_get_chrome` from your terminal to install the necessary dependency.

## more examples

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

![plot_box](https://github.com/smeisegeier/pandas-plots/blob/main/img/2024-02-13-00-40-27.png?raw=true)

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

![describe_df](https://github.com/smeisegeier/pandas-plots/blob/main/img/2024-02-14-20-49-00.png?raw=true)

```python
# 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](https://github.com/smeisegeier/pandas-plots/blob/main/img/2024-03-24-09-59-32.png?raw=true)

```python
# 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](https://github.com/smeisegeier/pandas-plots/blob/main/img/2024-02-19-20-49-52.png?raw=true)

## tags

#pandas, #plotly, #visualizations, #statistics
            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pandas-plots",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": null,
    "keywords": "tables, pivot, plotly, venn, plot, vizualization",
    "author": "smeisegeier",
    "author_email": "smeisegeier <dexterDSD@googlemail.com>",
    "download_url": "https://files.pythonhosted.org/packages/64/0c/254873e0b4e13b7208bd61e4cdb8eb87bcc55684059f65df6a0c0abf605d/pandas_plots-0.15.13.tar.gz",
    "platform": null,
    "description": "# pandas-plots\n\n![PyPI - Version](https://img.shields.io/pypi/v/pandas-plots) ![GitHub last commit](https://img.shields.io/github/last-commit/smeisegeier/pandas-plots?logo=github) ![GitHub License](https://img.shields.io/github/license/smeisegeier/pandas-plots?logo=github) ![py3.10](https://img.shields.io/badge/python-3.10_|_3.11_|_3.12-blue.svg?logo=data:image/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9InVybCgjcHlZZWxsb3cpIi8+CgogIDxjaXJjbGUgcj0iNCIgY3g9IjY0IiBjeT0iODgiIGZpbGw9IiNGRkYiLz4KICA8Y2lyY2xlIHI9IjQiIGN4PSIzNyIgY3k9IjE1IiBmaWxsPSIjRkZGIi8+Cjwvc3ZnPgo=)\n\n## usage\n\ninstall / update package\n\n```bash\nuv add -U pandas-plots\n# if no uv is available:\n# pip install pandas-plots -U\n```\n\ninclude in python\n\n```python\nfrom pandas_plots import tbl, pls, ven, hlp\n```\n\n## example\n\n```python\n# load sample dataset from seaborn\nimport seaborn as sb\ndf = sb.load_dataset('taxis')\n```\n\n```python\n_df = df[[\"passengers\", \"distance\", \"fare\"]][:5]\ntbl.show_num_df(\n    _df,\n    total_axis=\"xy\",\n    total_mode=\"mean\",\n    data_bar_axis=\"xy\",\n    pct_axis=\"xy\",\n    precision=0,\n    kpi_mode=\"max_min_x\",\n    kpi_rag_list=(1,7),\n)\n```\n\n![show_num](https://github.com/smeisegeier/pandas-plots/blob/main/img/2024-03-02-17-33-43.png?raw=true)\n\n## why use pandas-plots\n\n`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:\n\n- `tbl` utilities for table descriptions\n  - `show_num_df()` displays a table as styled version with additional information\n  - `describe_df()` an alternative version of pandas `describe()` function\n  - `descr_db()` a very short descr for a `duckdb` relation\n  - `pivot_df()` gets a pivot table of a 3 column dataframe (or 2 columns if no weights are given)\n  - `print_summary()` shows statistics for a pandas DataFrame or Series\n<br>\n\n- `pls` for plotly visualizations\n  - `plot_box()` auto annotated boxplot w/ violin option\n  - `plot_boxes()` multiple boxplots _(annotation is experimental)_\n  - `plot_stacked_bars()` shortcut to stacked bars\n  - `plots_bars()` a standardized bar plot for a **categorical** column\n    - features confidence intervals via `use_ci` option\n  - `plot_histogram()` histogram for one or more **numerical** columns\n  - `plot_joints()` a joint plot for **exactly two numerical** columns\n  - `plot_quadrants()` quickly shows a 2x2 heatmap\n  - `plot_facet_stacked_bars()` shows stacked bars for a facet value as subplots \n  - `plot_sankey()` generates a Sankey diagram\n<br>\n\n- `ven` offers functions for _venn diagrams_\n  - `show_venn2()` displays a venn diagram for 2 sets\n  - `show_venn3()` displays a venn diagram for 3 sets\n<br>\n\n- `hlp` contains some (variety) helper functions\n  - `to_series()` converts a dataframe to a series\n  - `mean_confidence_interval()` calculates mean and confidence interval for a series\n  - `wrap_text()` formats strings or lists to a given width to fit nicely on the screen\n  - `replace_delimiter_outside_quotes()` when manual import of csv files is needed: replaces delimiters only outside of quotes\n  - `create_barcode_from_url()` creates a barcode from a given URL\n  - `add_datetime_col()` adds a datetime columns to a dataframe (chainable)\n  - `show_package_version` prints version of a list of packages\n  - `get_os` helps to identify and ensure operating system at runtime\n  - `add_bitmask_label()` adds a column to the data that resolves a bitmask column into human-readable labels\n  - `find_cols()` finds all columns in a list of columns that contain any of the given stubs\n  - `add_measures_to_pyg_config()` adds measures to a pygwalker config file to avoid frequent manual update\n<br>\n\n> theme setting \u2600\ufe0f \ud83c\udf14 can be controlled through all functions by setting the environment variable `'THEME'` to either `'light'` or `'dark'`\n\n> renderer can be controlled through all functions by setting the environment variable `'RENDERER'` to `'png'` for printing to markdown or pdf\n\n## prerequisites\n\n- \u26a0\ufe0f for static image generation, this package uses Plotly's kaleido engine, which requires a system-wide installation of the Chrome or Chromium browser\n- if image generation fails, it may be because a compatible browser is missing\n- in such cases, please run `kaleido_get_chrome` from your terminal to install the necessary dependency.\n\n## more examples\n\n```python\npls.plot_box(df['fare'], height=400, violin=True)\n```\n\n![plot_box](https://github.com/smeisegeier/pandas-plots/blob/main/img/2024-02-13-00-40-27.png?raw=true)\n\n```python\n# quick and exhaustive description of any table\ntbl.describe_df(df, 'taxis', top_n_uniques=5)\n```\n\n![describe_df](https://github.com/smeisegeier/pandas-plots/blob/main/img/2024-02-14-20-49-00.png?raw=true)\n\n```python\n# show bars with confidence intervals\n_df = df[[\"payment\", \"fare\"]]\npls.plot_bars(\n    _df,\n    dropna=False,\n    use_ci=True,\n    height=600,\n    width=800,\n    precision=1,\n)\n```\n\n![bars_with_ci](https://github.com/smeisegeier/pandas-plots/blob/main/img/2024-03-24-09-59-32.png?raw=true)\n\n```python\n# show venn diagram for 3 sets\nfrom pandas_plots import ven\n\nset_a = {'ford','ferrari','mercedes', 'bmw'}\nset_b = {'opel','bmw','bentley','audi'}\nset_c = {'ferrari','bmw','chrysler','renault','peugeot','fiat'}\n_df, _details = ven.show_venn3(\n    title=\"taxis\",\n    a_set=set_a,\n    a_label=\"cars1\",\n    b_set=set_b,\n    b_label=\"cars2\",\n    c_set=set_c,\n    c_label=\"cars3\",\n    verbose=0,\n    size=8,\n)\n```\n\n![venn](https://github.com/smeisegeier/pandas-plots/blob/main/img/2024-02-19-20-49-52.png?raw=true)\n\n## tags\n\n#pandas, #plotly, #visualizations, #statistics",
    "bugtrack_url": null,
    "license": null,
    "summary": "A collection of helper for table handling and visualization",
    "version": "0.15.13",
    "project_urls": {
        "Bug Tracker": "https://github.com/smeisegeier/pandas-plots/issues",
        "Homepage": "https://github.com/smeisegeier/pandas-plots",
        "Repository": "https://github.com/smeisegeier/pandas-plots"
    },
    "split_keywords": [
        "tables",
        " pivot",
        " plotly",
        " venn",
        " plot",
        " vizualization"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "6e1bf8e4d220675f2b619838e5337419d24ab384ade06a39832dc0501d8f21d9",
                "md5": "71f69e45d9f70841e12d745a4ae6c841",
                "sha256": "a7e5683ee483995fbc8c1dca28a5972442f88158e488c7c21681f804cdc21f44"
            },
            "downloads": -1,
            "filename": "pandas_plots-0.15.13-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "71f69e45d9f70841e12d745a4ae6c841",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 39338,
            "upload_time": "2025-08-15T12:34:04",
            "upload_time_iso_8601": "2025-08-15T12:34:04.770274Z",
            "url": "https://files.pythonhosted.org/packages/6e/1b/f8e4d220675f2b619838e5337419d24ab384ade06a39832dc0501d8f21d9/pandas_plots-0.15.13-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "640c254873e0b4e13b7208bd61e4cdb8eb87bcc55684059f65df6a0c0abf605d",
                "md5": "1a5e3f26262ee8822291177d316f94f0",
                "sha256": "39ae871f2bd9279ec3452190c877aedc8034922cd5890c62a7e77242e683ba1c"
            },
            "downloads": -1,
            "filename": "pandas_plots-0.15.13.tar.gz",
            "has_sig": false,
            "md5_digest": "1a5e3f26262ee8822291177d316f94f0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 37097,
            "upload_time": "2025-08-15T12:34:06",
            "upload_time_iso_8601": "2025-08-15T12:34:06.032640Z",
            "url": "https://files.pythonhosted.org/packages/64/0c/254873e0b4e13b7208bd61e4cdb8eb87bcc55684059f65df6a0c0abf605d/pandas_plots-0.15.13.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-15 12:34:06",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "smeisegeier",
    "github_project": "pandas-plots",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pandas-plots"
}
        
Elapsed time: 0.77731s