pandas-plots 0.12.21__py3-none-any.whl → 0.12.23__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
@@ -1016,6 +1016,7 @@ def plot_box(
1016
1016
  lvl3 = height * 0.25
1017
1017
 
1018
1018
  caption = _set_caption(caption)
1019
+ log_str = " (log-scale)" if use_log else ""
1019
1020
  dict = {
1020
1021
  "data_frame": ser,
1021
1022
  "orientation": "h",
@@ -1026,7 +1027,7 @@ def plot_box(
1026
1027
  # 'box':True,
1027
1028
  "log_x": use_log, # * logarithmic scale, axis is always x
1028
1029
  # "notched": True,
1029
- "title": f"{caption}[{ser.name}], n = {n_:_}" if not title else title,
1030
+ "title": f"{caption}[{ser.name}]{log_str}, n = {n_:_}" if not title else title,
1030
1031
  }
1031
1032
 
1032
1033
  fig = px.violin(**{**dict, "box": True}) if violin else px.box(**dict)
@@ -1141,7 +1142,7 @@ def plot_boxes(
1141
1142
  width (int): The width of the plot.
1142
1143
  annotations (bool): Whether to add annotations to the plot.
1143
1144
  summary (bool): Whether to add a summary to the plot.
1144
- use_log (bool): Whether to use logarithmic scale for the plot.
1145
+ use_log (bool): Whether to use logarithmic scale for the plot (cannot show negative values).
1145
1146
  png_path (Path | str, optional): The path to save the image as a png file. Defaults to None.
1146
1147
 
1147
1148
  Returns:
@@ -1173,6 +1174,7 @@ def plot_boxes(
1173
1174
  items = df.iloc[:, 0].unique()
1174
1175
 
1175
1176
  caption = _set_caption(caption)
1177
+ log_str = " (log-scale)" if use_log else ""
1176
1178
 
1177
1179
  # * main plot
1178
1180
  fig = px.box(
@@ -1188,7 +1190,7 @@ def plot_boxes(
1188
1190
  log_y=use_log,
1189
1191
  # color_discrete_sequence=px.colors.qualitative.Plotly,
1190
1192
  title=(
1191
- f"{caption}[{df.columns[0]}] on [{df.columns[1]}], n = {len(df):_.0f}"
1193
+ f"{caption}[{df.columns[0]}] by [{df.columns[1]}]{log_str}, n = {len(df):_.0f}"
1192
1194
  if not title
1193
1195
  else title
1194
1196
  ),
@@ -1259,7 +1261,7 @@ def plot_boxes(
1259
1261
  fig.update_yaxes(title_text=df.columns[1])
1260
1262
  fig.update_layout(boxmode="group") # Ensures boxes are not too compressed
1261
1263
  fig.update_layout(showlegend=False)
1262
- fig.update_traces(marker=dict(size=7), width=box_width) # Adjust width (default ~0.5)
1264
+ fig.update_traces(marker=dict(size=5), width=box_width) # Adjust width (default ~0.5)
1263
1265
 
1264
1266
  fig.show("png")
1265
1267
  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.23
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=ISmQjIPI_63e7mN4A_pWHJ8IGNArfJjlEjPRQJF47U8,49173
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.23.dist-info/licenses/LICENSE,sha256=ltLbQWUCs-GBQlTPXbt5nHNBE9U5LzjjoS1Y8hHETM4,1051
7
+ pandas_plots-0.12.23.dist-info/METADATA,sha256=MsxBoqLqVLTIjaL9xVlWQA6mNNNMHd8dIdMPurxCYLg,7564
8
+ pandas_plots-0.12.23.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
9
+ pandas_plots-0.12.23.dist-info/pii.py,sha256=2WKE-W9s285jPdsTqCgt1uxuW4lj1PYCVOYB2fYDNwQ,2195
10
+ pandas_plots-0.12.23.dist-info/top_level.txt,sha256=XnaNuIHBqMmCeh_U7nKOYTwFue_SIA0wxuDgdPmnnSk,13
11
+ pandas_plots-0.12.23.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
- Copyright 2024 smeisegeier
1
+ Copyright 2025 smeisegeier
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
4
 
@@ -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,,