pandas-plots 0.15.3__py3-none-any.whl → 0.15.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pandas_plots/pls.py +21 -17
- pandas_plots/tbl.py +1 -1
- {pandas_plots-0.15.3.dist-info → pandas_plots-0.15.5.dist-info}/METADATA +4 -2
- pandas_plots-0.15.5.dist-info/RECORD +9 -0
- pandas_plots-0.15.3.dist-info/RECORD +0 -9
- {pandas_plots-0.15.3.dist-info → pandas_plots-0.15.5.dist-info}/WHEEL +0 -0
- {pandas_plots-0.15.3.dist-info → pandas_plots-0.15.5.dist-info}/licenses/LICENSE +0 -0
pandas_plots/pls.py
CHANGED
@@ -233,7 +233,7 @@ def plot_stacked_bars(
|
|
233
233
|
height: int = 500,
|
234
234
|
width: int = 2000,
|
235
235
|
title: str = None,
|
236
|
-
renderer: Literal["png", "svg",
|
236
|
+
renderer: Literal["png", "svg", "notebook"] = "notebook",
|
237
237
|
caption: str = None,
|
238
238
|
sort_values: bool = False,
|
239
239
|
sort_values_index: bool = False,
|
@@ -375,19 +375,24 @@ def plot_stacked_bars(
|
|
375
375
|
caption = _set_caption(caption)
|
376
376
|
|
377
377
|
# * after grouping add cols for pct and formatting
|
378
|
-
df["cnt_pct_all_only"] = df["value"].apply(lambda x: f"{(x
|
379
|
-
df["cnt_pct_bar_only"] = (df["value"] / bar_totals * 100).apply(lambda x: f"{x:.{precision}f}%")
|
378
|
+
df["cnt_pct_all_only"] = (df["value"] / n * 100).apply(lambda x: f"{(x):.{precision}f}%")
|
379
|
+
df["cnt_pct_bar_only"] = (df["value"] / bar_totals * 100).apply(lambda x: f"{(x):.{precision}f}%")
|
380
380
|
|
381
381
|
# * format output
|
382
382
|
df["cnt_str"] = df["value"].apply(lambda x: f"{x:_.{precision}f}")
|
383
383
|
|
384
384
|
divider2 = "<br>" if orientation == "v" else " "
|
385
385
|
|
386
|
+
# Modify this section
|
386
387
|
df["cnt_pct_all_str"] = df.apply(
|
387
|
-
lambda row: f"{row['cnt_str']}{divider2}({row['cnt_pct_all_only']})"
|
388
|
+
lambda row: f"{row['cnt_str']}{divider2}({row['cnt_pct_all_only']})"
|
389
|
+
if (row["value"] / n * 100) >= 5 else row["cnt_str"],
|
390
|
+
axis=1
|
388
391
|
)
|
389
392
|
df["cnt_pct_bar_str"] = df.apply(
|
390
|
-
lambda row: f"{row['cnt_str']}{divider2}({row['cnt_pct_bar_only']})"
|
393
|
+
lambda row: f"{row['cnt_str']}{divider2}({row['cnt_pct_bar_only']})"
|
394
|
+
if (row["value"] / bar_totals.loc[row.name] * 100) >= 5 else row["cnt_str"],
|
395
|
+
axis=1
|
391
396
|
)
|
392
397
|
|
393
398
|
text_to_show = "cnt_str"
|
@@ -499,7 +504,7 @@ def plot_stacked_bars(
|
|
499
504
|
fig.write_image(Path(png_path).as_posix())
|
500
505
|
|
501
506
|
fig.show(
|
502
|
-
renderer=renderer,
|
507
|
+
renderer=renderer or os.getenv("RENDERER"),
|
503
508
|
width=width,
|
504
509
|
height=height,
|
505
510
|
)
|
@@ -521,7 +526,7 @@ def plot_bars(
|
|
521
526
|
use_ci: bool = False,
|
522
527
|
ci_agg: Literal["mean", "median"] = "mean",
|
523
528
|
precision: int = 0,
|
524
|
-
renderer: Literal["png", "svg",
|
529
|
+
renderer: Literal["png", "svg", "notebook"] = "notebook",
|
525
530
|
png_path: Path | str = None,
|
526
531
|
) -> None:
|
527
532
|
"""
|
@@ -780,7 +785,7 @@ def plot_bars(
|
|
780
785
|
|
781
786
|
# * set axis title
|
782
787
|
_fig.show(
|
783
|
-
renderer,
|
788
|
+
renderer=renderer or os.getenv("RENDERER"),
|
784
789
|
width=width,
|
785
790
|
height=height,
|
786
791
|
)
|
@@ -804,7 +809,7 @@ def plot_histogram(
|
|
804
809
|
width: int = 1600,
|
805
810
|
text_auto: bool = True,
|
806
811
|
barmode: Literal["group", "overlay", "relative"] = "relative",
|
807
|
-
renderer: Literal["png", "svg",
|
812
|
+
renderer: Literal["png", "svg", "notebook"] = "notebook",
|
808
813
|
caption: str = None,
|
809
814
|
title: str = None,
|
810
815
|
png_path: Path | str = None,
|
@@ -1003,7 +1008,7 @@ def plot_box(
|
|
1003
1008
|
x_max: float = None,
|
1004
1009
|
use_log: bool = False,
|
1005
1010
|
png_path: Path | str = None,
|
1006
|
-
renderer: Literal["png", "svg",
|
1011
|
+
renderer: Literal["png", "svg", "notebook"] = "notebook",
|
1007
1012
|
) -> None:
|
1008
1013
|
"""
|
1009
1014
|
Plots a horizontal box plot for the given pandas Series.
|
@@ -1138,7 +1143,7 @@ def plot_box(
|
|
1138
1143
|
)
|
1139
1144
|
|
1140
1145
|
fig.show(
|
1141
|
-
renderer=renderer,
|
1146
|
+
renderer=renderer or os.getenv("RENDERER"),
|
1142
1147
|
width=width,
|
1143
1148
|
height=height,
|
1144
1149
|
)
|
@@ -1167,7 +1172,7 @@ def plot_boxes(
|
|
1167
1172
|
use_log: bool = False,
|
1168
1173
|
box_width: float = 0.5,
|
1169
1174
|
png_path: Path | str = None,
|
1170
|
-
renderer: Literal["png", "svg",
|
1175
|
+
renderer: Literal["png", "svg", "notebook"] = "notebook",
|
1171
1176
|
) -> None:
|
1172
1177
|
"""
|
1173
1178
|
[Experimental] Plot vertical boxes for each unique item in the DataFrame and add annotations for statistics.
|
@@ -1304,7 +1309,7 @@ def plot_boxes(
|
|
1304
1309
|
marker=dict(size=5), width=box_width
|
1305
1310
|
) # Adjust width (default ~0.5)
|
1306
1311
|
|
1307
|
-
fig.show(renderer=renderer, width=width, height=height)
|
1312
|
+
fig.show(renderer=renderer or os.getenv("RENDERER"), width=width, height=height)
|
1308
1313
|
if summary:
|
1309
1314
|
# * sort df by first column
|
1310
1315
|
print_summary(df=df.sort_values(df.columns[0]), precision=precision)
|
@@ -1326,7 +1331,7 @@ def plot_facet_stacked_bars(
|
|
1326
1331
|
subplot_size: int = 300,
|
1327
1332
|
color_palette: str = "Plotly",
|
1328
1333
|
caption: str = "",
|
1329
|
-
renderer: Optional[Literal["png", "svg"]] = "png",
|
1334
|
+
renderer: Optional[Literal["png", "svg", "notebook"]] = "png",
|
1330
1335
|
annotations: bool = False,
|
1331
1336
|
precision: int = 0,
|
1332
1337
|
png_path: Optional[Path] = None,
|
@@ -1517,7 +1522,7 @@ def plot_facet_stacked_bars(
|
|
1517
1522
|
fig.write_image(str(png_path))
|
1518
1523
|
|
1519
1524
|
fig.show(
|
1520
|
-
renderer=renderer,
|
1525
|
+
renderer=renderer or os.getenv("RENDERER"),
|
1521
1526
|
width=subplot_size * subplots_per_row,
|
1522
1527
|
height=subplot_size
|
1523
1528
|
* (-(-len(aggregated_df["facet"].unique()) // subplots_per_row)),
|
@@ -1855,8 +1860,7 @@ def plot_sankey(
|
|
1855
1860
|
)
|
1856
1861
|
|
1857
1862
|
fig.update_layout(title_text=chart_title, font_size=font_size)
|
1858
|
-
fig.show(renderer=renderer, width=width, height=height)
|
1859
|
-
|
1863
|
+
fig.show(renderer=renderer or os.getenv("RENDERER"), width=width, height=height)
|
1860
1864
|
|
1861
1865
|
# * extend objects to enable chaining
|
1862
1866
|
pd.DataFrame.plot_bars = plot_bars
|
pandas_plots/tbl.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: pandas-plots
|
3
|
-
Version: 0.15.
|
3
|
+
Version: 0.15.5
|
4
4
|
Summary: A collection of helper for table handling and visualization
|
5
5
|
Project-URL: Homepage, https://github.com/smeisegeier/pandas-plots
|
6
6
|
Project-URL: Repository, https://github.com/smeisegeier/pandas-plots
|
@@ -120,7 +120,9 @@ tbl.show_num_df(
|
|
120
120
|
- `add_measures_to_pyg_config()` adds measures to a pygwalker config file to avoid frequent manual update
|
121
121
|
<br>
|
122
122
|
|
123
|
-
>
|
123
|
+
> theme setting ☀️ 🌔 can be controlled through all functions by setting the environment variable `'THEME'` to either `'light'` or `'dark'`
|
124
|
+
|
125
|
+
> renderer can be controlled through all functions by setting the environment variable `'RENDERER'` to `'png'` for printing to markdown or pdf
|
124
126
|
|
125
127
|
## prerequisites
|
126
128
|
|
@@ -0,0 +1,9 @@
|
|
1
|
+
pandas_plots/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
+
pandas_plots/hlp.py,sha256=z8rrVNbH9qMohdXPT-FksP-VkTOjI0bGFj47Sw5p3aY,21141
|
3
|
+
pandas_plots/pls.py,sha256=AVi4pexDoJPUCAntrf1OlBvu_Jiwi22zKB01nVL42AM,65107
|
4
|
+
pandas_plots/tbl.py,sha256=YR-Wq2SXNFBqgqBJncrKPirb0hBKBLm-A8H2BqkxaI4,33057
|
5
|
+
pandas_plots/ven.py,sha256=2x3ACo2vSfO3q6fv-UdDQ0h1SJyt8WChBGgE5SDCdCk,11673
|
6
|
+
pandas_plots-0.15.5.dist-info/METADATA,sha256=KwyTlqPc0wCHLHahN2tGmCNSbwdTeGppwy5QJFF2xsk,8001
|
7
|
+
pandas_plots-0.15.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
8
|
+
pandas_plots-0.15.5.dist-info/licenses/LICENSE,sha256=ltLbQWUCs-GBQlTPXbt5nHNBE9U5LzjjoS1Y8hHETM4,1051
|
9
|
+
pandas_plots-0.15.5.dist-info/RECORD,,
|
@@ -1,9 +0,0 @@
|
|
1
|
-
pandas_plots/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
pandas_plots/hlp.py,sha256=z8rrVNbH9qMohdXPT-FksP-VkTOjI0bGFj47Sw5p3aY,21141
|
3
|
-
pandas_plots/pls.py,sha256=xA8Am76FUfGr4Sfq8YSSwDJfVTCtKLaDVVVH6o6YSIg,64691
|
4
|
-
pandas_plots/tbl.py,sha256=y_4ZFVogCRp4v8g6IKzxEnGVHdRUZbF0ACLugJW2_G8,33057
|
5
|
-
pandas_plots/ven.py,sha256=2x3ACo2vSfO3q6fv-UdDQ0h1SJyt8WChBGgE5SDCdCk,11673
|
6
|
-
pandas_plots-0.15.3.dist-info/METADATA,sha256=toYqCOH5bU0HGq5TVg_FGr4Zc1j2Ox5uX5A9lVlon70,7853
|
7
|
-
pandas_plots-0.15.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
8
|
-
pandas_plots-0.15.3.dist-info/licenses/LICENSE,sha256=ltLbQWUCs-GBQlTPXbt5nHNBE9U5LzjjoS1Y8hHETM4,1051
|
9
|
-
pandas_plots-0.15.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|