smeisegeier / pandas-plots

MIT License
0 stars 0 forks source link

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:

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