pandas-plots 0.12.2__tar.gz → 0.12.4__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: pandas-plots
3
- Version: 0.12.2
3
+ Version: 0.12.4
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
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = pandas-plots
3
- version = 0.12.2
3
+ version = 0.12.4
4
4
  author = smeisegeier
5
5
  author_email = dexterDSDo@googlemail.com
6
6
  description = A collection of helper for table handling and visualization
@@ -278,6 +278,44 @@ def plot_stacked_bars(
278
278
  height=height,
279
279
  color_discrete_map=column_colors, # Use assigned colors
280
280
  )
281
+ # * get longest bar
282
+ bar_max = (
283
+ df.groupby(col_index)[df.columns[2]].sum().sort_values(ascending=False).iloc[0]
284
+ * BAR_LENGTH_MULTIPLIER
285
+ )
286
+ # * ignore if bar mode is on
287
+ if not relative:
288
+ if orientation == "v":
289
+ _fig.update_yaxes(range=[0, bar_max])
290
+ else:
291
+ _fig.update_xaxes(range=[0, bar_max])
292
+ else:
293
+ _fig.update_layout(barnorm="percent")
294
+
295
+ # * set title properties
296
+ _fig.update_layout(
297
+ title={
298
+ # 'x': 0.1,
299
+ "y": 0.95,
300
+ "xanchor": "left",
301
+ "yanchor": "top",
302
+ "font": {
303
+ "size": 24,
304
+ },
305
+ },
306
+ )
307
+
308
+ # * set dtick
309
+ if orientation == "h":
310
+ if relative:
311
+ _fig.update_xaxes(dtick=5)
312
+ elif normalize:
313
+ _fig.update_xaxes(dtick=0.05)
314
+ else:
315
+ if relative:
316
+ _fig.update_yaxes(dtick=5)
317
+ elif normalize:
318
+ _fig.update_yaxes(dtick=0.05)
281
319
 
282
320
  # * show grids, set to smaller distance on pct scale
283
321
  _fig.update_xaxes(showgrid=True, gridwidth=1)
@@ -162,12 +162,7 @@ def describe_df(
162
162
  # * only show numerics
163
163
  for col in df.select_dtypes("number").columns:
164
164
  _u, _h = get_uniques_header(col)
165
-
166
- # * extra care for scipy metrics, these are very vulnarable to nan
167
- # print(
168
- # f"{_h} min: {round(df[col].min(),3):_} | max: {round(df[col].max(),3):_} | median: {round(df[col].median(),3):_} | mean: {round(df[col].mean(),3):_} | std: {round(df[col].std(),3):_} | cv: {round(df[col].std() / df[col].mean(),3):_} | sum: {round(df[col].sum(),3):_} | skew: {round(stats.skew(df[col].dropna().tolist()),3)} | kurto: {round(stats.kurtosis(df[col].dropna().tolist()),3)}"
169
- # )
170
- print_summary(df[col], _h)
165
+ print_summary(df=df[col], name=_h)
171
166
 
172
167
  # * show first 3 rows
173
168
  display(df[:3])
@@ -782,8 +777,4 @@ def print_summary(df: pd.DataFrame | pd.Series, show: bool = True, name: str="
782
777
  for col in df.select_dtypes("number").columns:
783
778
  summary = print_summary_ser(ser=df[col],show=show, name=col)
784
779
 
785
- # enable chaining
786
- pd.DataFrame.print_summary = print_summary
787
- pd.Series.print_summary = print_summary
788
-
789
780
  return summary
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: pandas-plots
3
- Version: 0.12.2
3
+ Version: 0.12.4
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
File without changes
File without changes