pandas-plots 0.12.21__py3-none-any.whl → 0.12.22__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/hlp.py CHANGED
@@ -195,7 +195,8 @@ def wrap_text(
195
195
  line = line + word_s + " "
196
196
  # * reset if counter exceeds limit, or if word ends with newline
197
197
  if i >= max_items_in_line or str(word).endswith("\n"):
198
- out = out + line + "\n"
198
+ # out = out + line + "\n"
199
+ out = out + line.rstrip() + " \n"
199
200
  line = ""
200
201
  i = 0
201
202
  # else:
pandas_plots/pls.py CHANGED
@@ -1141,7 +1141,7 @@ def plot_boxes(
1141
1141
  width (int): The width of the plot.
1142
1142
  annotations (bool): Whether to add annotations to the plot.
1143
1143
  summary (bool): Whether to add a summary to the plot.
1144
- use_log (bool): Whether to use logarithmic scale for the plot.
1144
+ use_log (bool): Whether to use logarithmic scale for the plot (cannot show negative values).
1145
1145
  png_path (Path | str, optional): The path to save the image as a png file. Defaults to None.
1146
1146
 
1147
1147
  Returns:
@@ -1259,7 +1259,7 @@ def plot_boxes(
1259
1259
  fig.update_yaxes(title_text=df.columns[1])
1260
1260
  fig.update_layout(boxmode="group") # Ensures boxes are not too compressed
1261
1261
  fig.update_layout(showlegend=False)
1262
- fig.update_traces(marker=dict(size=7), width=box_width) # Adjust width (default ~0.5)
1262
+ fig.update_traces(marker=dict(size=5), width=box_width) # Adjust width (default ~0.5)
1263
1263
 
1264
1264
  fig.show("png")
1265
1265
  if summary:
pandas_plots/tbl.py CHANGED
@@ -121,14 +121,14 @@ def describe_df(
121
121
  if df[col].notna().sum() == 0 and df[col].dtype == "float":
122
122
  df[col] = df[col].astype(str)
123
123
 
124
- print(f"🔵 {'*'*3} df: {caption} {'*'*3}")
125
- print(f"🟣 shape: ({df.shape[0]:_}, {df.shape[1]}) columns: {np.array(df.columns)} ")
124
+ print(f"🔵 {'*'*3} df: {caption} {'*'*3} ")
125
+ print(f"🟣 shape: ({df.shape[0]:_}, {df.shape[1]}) columns: {np.array(df.columns)} ")
126
126
  # print(f"🟣 shape: ({df.shape[0]:_}, {df.shape[1]}) columns: {df.columns.tolist()} ")
127
- print(f"🟣 duplicates: {df.duplicated().sum():_}")
128
- print(f"🟣 uniques: {wrap_text(str({col: f'{df[col].nunique():_}' for col in df})) }")
127
+ print(f"🟣 duplicates: {df.duplicated().sum():_} ")
128
+ print(f"🟣 uniques: {wrap_text(str({col: f'{df[col].nunique():_}' for col in df})) } ")
129
129
  # print(f"🟣 uniques: { {col: f'{df[col].nunique():_}' for col in df} }")
130
130
  # print(f"🟣 uniques: {{ {', '.join(f'{col}: {df[col].nunique():_}' for col in df)} }}")
131
- print(f"🟣 missings: {wrap_text(str({col: f'{df[col].isna().sum():_}' for col in df})) }")
131
+ print(f"🟣 missings: {wrap_text(str({col: f'{df[col].isna().sum():_}' for col in df})) } ")
132
132
  # print(f"🟣 missings: { {col: f'{df[col].isna().sum():_}' for col in df} }")
133
133
  # print(f"🟣 missings: {dict(df.isna().sum())}")
134
134
 
@@ -141,13 +141,13 @@ def describe_df(
141
141
  # unis = df[col].sort_values().unique()
142
142
  unis = list(df[col].value_counts().sort_index().index)
143
143
  # * get header
144
- header = f"🟠 {col}({len(unis):_}|{df[col].dtype})"
144
+ header = f"🟠 {col}({len(unis):_}|{df[col].dtype}) "
145
145
  return unis, header
146
146
 
147
147
  # hack this block somehow interferes with the plotly renderer. so its run even when use_columns=False
148
148
  if use_columns:
149
- print("--- column uniques (all)")
150
- print(f"🟠 index {wrap_text(df.index.tolist()[:top_n_uniques])}")
149
+ print("--- column uniques (all) ")
150
+ print(f"🟠 index {wrap_text(df.index.tolist()[:top_n_uniques])} ")
151
151
  for col in df.columns[:]:
152
152
  _u, _h = get_uniques_header(col)
153
153
  # * check col type
@@ -155,10 +155,10 @@ def describe_df(
155
155
  # * wrap output
156
156
  if use_columns:
157
157
  print(
158
- f"{_h} {wrap_text(_u[:top_n_uniques], max_items_in_line=70, use_apo=is_str)}"
158
+ f"{_h} {wrap_text(_u[:top_n_uniques], max_items_in_line=70, use_apo=is_str)} "
159
159
  )
160
160
 
161
- print("--- column stats (numeric)")
161
+ print("--- column stats (numeric) ")
162
162
  # * only show numerics
163
163
  for col in df.select_dtypes("number").columns:
164
164
  _u, _h = get_uniques_header(col)
@@ -793,7 +793,7 @@ def print_summary(df: pd.DataFrame | pd.Series, show: bool = True, name: str=" "
793
793
  # * extra care for scipy metrics, these are very vulnarable to nan
794
794
  if show:
795
795
  print(
796
- f"""{name} -> min: {min:_} | lower: {lower:_} | q25: {q1:_} | median: {med:_} | mean: {mean:_} | q75: {q3:_} | upper: {upper:_} | max: {max:_} | std: {std:_} | cv: {cv:_} | sum: {sum:_} | skew: {skew} | kurto: {kurto}""")
796
+ f"""{name} -> min: {min:_} | lower: {lower:_} | q25: {q1:_} | median: {med:_} | mean: {mean:_} | q75: {q3:_} | upper: {upper:_} | max: {max:_} | std: {std:_} | cv: {cv:_} | sum: {sum:_} | skew: {skew} | kurto: {kurto} """)
797
797
 
798
798
  summary = {
799
799
  "min": min,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pandas-plots
3
- Version: 0.12.21
3
+ Version: 0.12.22
4
4
  Summary: A collection of helper for table handling and visualization
5
5
  Home-page: https://github.com/smeisegeier/pandas-plots
6
6
  Author: smeisegeier
@@ -0,0 +1,11 @@
1
+ pandas_plots/hlp.py,sha256=i11Ep9P-u9O0bvexGTELRDUtmLzvNgNHxnkQTGf3DwQ,20838
2
+ pandas_plots/pii.py,sha256=2WKE-W9s285jPdsTqCgt1uxuW4lj1PYCVOYB2fYDNwQ,2195
3
+ pandas_plots/pls.py,sha256=APvF_cEYN28TtlpNNIJ2NPTA3chTP9ZHtwnVEuZ-skI,49059
4
+ pandas_plots/tbl.py,sha256=RJWBHeKGTAhGpVCY57TsS_dYR-FpInP-TOsKW_tU4V4,32556
5
+ pandas_plots/ven.py,sha256=2x3ACo2vSfO3q6fv-UdDQ0h1SJyt8WChBGgE5SDCdCk,11673
6
+ pandas_plots-0.12.22.dist-info/licenses/LICENSE,sha256=6KQ5KVAAhRaB-JJKpX4cefKvRZRgI7GUPc92_2d31XY,1051
7
+ pandas_plots-0.12.22.dist-info/METADATA,sha256=0bdvEP5M1SgmSJI3QKLd8MX1RjSrwzxlXWrygQNjHaM,7564
8
+ pandas_plots-0.12.22.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
9
+ pandas_plots-0.12.22.dist-info/pii.py,sha256=2WKE-W9s285jPdsTqCgt1uxuW4lj1PYCVOYB2fYDNwQ,2195
10
+ pandas_plots-0.12.22.dist-info/top_level.txt,sha256=XnaNuIHBqMmCeh_U7nKOYTwFue_SIA0wxuDgdPmnnSk,13
11
+ pandas_plots-0.12.22.dist-info/RECORD,,
@@ -1,11 +0,0 @@
1
- pandas_plots/hlp.py,sha256=uq-uXKgb9DtsrW_2cBmU-tf_akfEAcvPW2ma6YmKx7Y,20789
2
- pandas_plots/pii.py,sha256=2WKE-W9s285jPdsTqCgt1uxuW4lj1PYCVOYB2fYDNwQ,2195
3
- pandas_plots/pls.py,sha256=f890q1wYIGecRyzGxsMcmGPkE8v4JZmqXU56VWzC2ao,49029
4
- pandas_plots/tbl.py,sha256=LxMKJh4qkGuQZ1DdCZIq1tMS26F6elsqbe_uabvQx4E,32535
5
- pandas_plots/ven.py,sha256=2x3ACo2vSfO3q6fv-UdDQ0h1SJyt8WChBGgE5SDCdCk,11673
6
- pandas_plots-0.12.21.dist-info/licenses/LICENSE,sha256=6KQ5KVAAhRaB-JJKpX4cefKvRZRgI7GUPc92_2d31XY,1051
7
- pandas_plots-0.12.21.dist-info/METADATA,sha256=UM2wZnlloV1PCL2wYPwIFUCIRE4zoVagON1AgqrSsxU,7564
8
- pandas_plots-0.12.21.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
9
- pandas_plots-0.12.21.dist-info/pii.py,sha256=2WKE-W9s285jPdsTqCgt1uxuW4lj1PYCVOYB2fYDNwQ,2195
10
- pandas_plots-0.12.21.dist-info/top_level.txt,sha256=XnaNuIHBqMmCeh_U7nKOYTwFue_SIA0wxuDgdPmnnSk,13
11
- pandas_plots-0.12.21.dist-info/RECORD,,