pandas-plots 0.12.0__tar.gz → 0.12.1__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.0
3
+ Version: 0.12.1
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.0
3
+ version = 0.12.1
4
4
  author = smeisegeier
5
5
  author_email = dexterDSDo@googlemail.com
6
6
  description = A collection of helper for table handling and visualization
@@ -699,7 +699,9 @@ def show_num_df(
699
699
 
700
700
  return out
701
701
 
702
- def print_summary(df: pd.DataFrame | pd.Series, name: str="🟠 "):
702
+
703
+
704
+ def print_summary(df: pd.DataFrame | pd.Series, show: bool = True, name: str="🟠 "):
703
705
  """
704
706
  Print statistical summary for a pandas DataFrame or Series.
705
707
 
@@ -712,11 +714,13 @@ def print_summary(df: pd.DataFrame | pd.Series, name: str="🟠 "):
712
714
  Args:
713
715
  df (Union[pd.DataFrame, pd.Series]): Input DataFrame or Series. Only numeric columns
714
716
  in DataFrame are considered.
717
+ show (bool, optional): Whether to print the summary. Defaults to True.
718
+ name (str, optional): Prefix for the summary. Defaults to "🟠 "
715
719
  """
716
720
  if df.empty:
717
721
  return
718
722
 
719
- def print_summary_ser(ser: pd.Series, name: str=""):
723
+ def print_summary_ser(ser: pd.Series, show: bool=True, name: str=""):
720
724
  # Calculate IQR and pass `rng=(25, 75)` to get the interquartile range
721
725
  iqr_value = stats.iqr(ser)
722
726
 
@@ -744,14 +748,32 @@ def print_summary(df: pd.DataFrame | pd.Series, name: str="🟠 "):
744
748
  upper = max if upper > max else upper
745
749
 
746
750
  # * extra care for scipy metrics, these are very vulnarable to nan
747
- print(
748
- 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}""")
751
+ if show:
752
+ print(
753
+ 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}""")
754
+
755
+ summary = {
756
+ "min": min,
757
+ "lower": lower,
758
+ "q25": q1,
759
+ "median": med,
760
+ "mean": mean,
761
+ "q75": q3,
762
+ "upper": upper,
763
+ "max": max,
764
+ "std": std,
765
+ "cv": cv,
766
+ "sum": sum,
767
+ "skew": skew,
768
+ "kurto": kurto
769
+ }
770
+ return summary
749
771
 
750
772
  if isinstance(df, pd.Series):
751
- print_summary_ser(df, name)
752
- return
773
+ return print_summary_ser(df, show=show, name=name)
774
+
753
775
  if isinstance(df, pd.DataFrame):
754
776
  # * only show numerics
755
777
  for col in df.select_dtypes("number").columns:
756
- print_summary_ser(ser=df[col], name=col)
757
- return
778
+ summary = print_summary_ser(ser=df[col],show=show, name=col)
779
+ return summary
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: pandas-plots
3
- Version: 0.12.0
3
+ Version: 0.12.1
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