pandas-plots 0.11.19__tar.gz → 0.11.21__tar.gz
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-0.11.19/src/pandas_plots.egg-info → pandas_plots-0.11.21}/PKG-INFO +1 -1
- {pandas_plots-0.11.19 → pandas_plots-0.11.21}/setup.cfg +1 -1
- {pandas_plots-0.11.19 → pandas_plots-0.11.21}/src/pandas_plots/tbl.py +33 -3
- {pandas_plots-0.11.19 → pandas_plots-0.11.21/src/pandas_plots.egg-info}/PKG-INFO +1 -1
- {pandas_plots-0.11.19 → pandas_plots-0.11.21}/LICENSE +0 -0
- {pandas_plots-0.11.19 → pandas_plots-0.11.21}/README.md +0 -0
- {pandas_plots-0.11.19 → pandas_plots-0.11.21}/pyproject.toml +0 -0
- {pandas_plots-0.11.19 → pandas_plots-0.11.21}/src/pandas_plots/hlp.py +0 -0
- {pandas_plots-0.11.19 → pandas_plots-0.11.21}/src/pandas_plots/pii.py +0 -0
- {pandas_plots-0.11.19 → pandas_plots-0.11.21}/src/pandas_plots/pls.py +0 -0
- {pandas_plots-0.11.19 → pandas_plots-0.11.21}/src/pandas_plots/ven.py +0 -0
- {pandas_plots-0.11.19 → pandas_plots-0.11.21}/src/pandas_plots.egg-info/SOURCES.txt +0 -0
- {pandas_plots-0.11.19 → pandas_plots-0.11.21}/src/pandas_plots.egg-info/dependency_links.txt +0 -0
- {pandas_plots-0.11.19 → pandas_plots-0.11.21}/src/pandas_plots.egg-info/requires.txt +0 -0
- {pandas_plots-0.11.19 → pandas_plots-0.11.21}/src/pandas_plots.egg-info/top_level.txt +0 -0
@@ -30,10 +30,34 @@ KPI_LITERAL = Literal[
|
|
30
30
|
]
|
31
31
|
|
32
32
|
|
33
|
-
def descr_db(
|
33
|
+
def descr_db(
|
34
|
+
db: ddb.duckdb.DuckDBPyRelation,
|
35
|
+
caption: str = "db",
|
36
|
+
use_preview: bool = True,
|
37
|
+
)->None:
|
38
|
+
"""
|
39
|
+
Print a short description of the given duckdb relation.
|
40
|
+
|
41
|
+
Parameters
|
42
|
+
----------
|
43
|
+
db: ddb.duckdb.DuckDBPyRelation
|
44
|
+
The relation to be described
|
45
|
+
caption: str, optional
|
46
|
+
A caption to be printed left of the description. Defaults to "db".
|
47
|
+
use_preview: bool, optional
|
48
|
+
Whether to print a preview of the first 3 rows of the relation. Defaults to True.
|
49
|
+
|
50
|
+
Returns
|
51
|
+
-------
|
52
|
+
None
|
53
|
+
"""
|
34
54
|
cols = ", ".join(db.columns)
|
35
55
|
print(f'🗄️ {caption}\t{db.count("*").fetchone()[0]:_}, {db.columns.__len__()}\n\t("{cols}")')
|
36
56
|
|
57
|
+
if use_preview:
|
58
|
+
db.limit(3).show()
|
59
|
+
return
|
60
|
+
|
37
61
|
def describe_df(
|
38
62
|
df: pd.DataFrame,
|
39
63
|
caption: str,
|
@@ -99,7 +123,10 @@ def describe_df(
|
|
99
123
|
print(f"🟣 shape: ({df.shape[0]:_}, {df.shape[1]}) columns: {np.array(df.columns)} ")
|
100
124
|
# print(f"🟣 shape: ({df.shape[0]:_}, {df.shape[1]}) columns: {df.columns.tolist()} ")
|
101
125
|
print(f"🟣 duplicates: {df.duplicated().sum():_}")
|
102
|
-
print(f"🟣
|
126
|
+
print(f"🟣 uniques: { {col: f'{df[col].nunique():_}' for col in df} }")
|
127
|
+
# print(f"🟣 uniques: {{ {', '.join(f'{col}: {df[col].nunique():_}' for col in df)} }}")
|
128
|
+
print(f"🟣 missings: { {col: f'{df[col].isna().sum():_}' for col in df} }")
|
129
|
+
# print(f"🟣 missings: {dict(df.isna().sum())}")
|
103
130
|
|
104
131
|
def get_uniques_header(col: str):
|
105
132
|
# * sorting has issues when col is of mixed type (object)
|
@@ -367,6 +394,7 @@ def show_num_df(
|
|
367
394
|
kpi_mode: KPI_LITERAL = None,
|
368
395
|
kpi_shape: Literal["squad", "circle"] = "squad",
|
369
396
|
show_as_pct: bool = False,
|
397
|
+
alter_font: bool = True,
|
370
398
|
):
|
371
399
|
"""
|
372
400
|
A function to display a DataFrame with various options for styling and formatting, including the ability to show totals, apply data bar coloring, and control the display precision.
|
@@ -391,6 +419,7 @@ def show_num_df(
|
|
391
419
|
- kpi_rag_list: a list of floats indicating the thresholds for rag lights. The list should have 2 elements.
|
392
420
|
- kpi_shape: a Literal indicating the shape of the KPIs ["squad", "circle"]
|
393
421
|
- show_as_pct: a boolean indicating whether to show value as percentage (only advised on values ~1)
|
422
|
+
- alter_font: a boolean indicating whether to alter the font family
|
394
423
|
|
395
424
|
The function returns a styled representation of the DataFrame.
|
396
425
|
"""
|
@@ -601,7 +630,8 @@ def show_num_df(
|
|
601
630
|
out.format(formatter=formatter)
|
602
631
|
|
603
632
|
# * apply fonts for cells
|
604
|
-
|
633
|
+
if alter_font:
|
634
|
+
out.set_properties(**{"font-family": "Courier"})
|
605
635
|
|
606
636
|
# * apply fonts for th (inkl. index)
|
607
637
|
_props = [
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{pandas_plots-0.11.19 → pandas_plots-0.11.21}/src/pandas_plots.egg-info/dependency_links.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|