pandas-plots 0.11.4__tar.gz → 0.11.5__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.1
2
2
  Name: pandas-plots
3
- Version: 0.11.4
3
+ Version: 0.11.5
4
4
  Summary: A collection of helper for table handling and vizualization
5
5
  Home-page: https://github.com/smeisegeier/pandas-plots
6
6
  Author: smeisegeier
@@ -24,8 +24,8 @@ Requires-Dist: plotly>=5.18.0
24
24
  Requires-Dist: matplotlib>=3.8.2
25
25
  Requires-Dist: matplotlib-venn>=0.11.10
26
26
  Requires-Dist: seaborn>=0.13.2
27
- Requires-Dist: Jinja2>=3.1.3
28
- Requires-Dist: requests>=2.31.0
27
+ Requires-Dist: Jinja2>=3.1.4
28
+ Requires-Dist: requests>=2.32.0
29
29
  Requires-Dist: numpy<2.0.0
30
30
 
31
31
  # pandas-plots
@@ -77,7 +77,7 @@ tbl.show_num_df(
77
77
  - `tbl` utilities for table descriptions
78
78
  - 🌟`show_num_df()` displays a table as styled version with additional information
79
79
  - `describe_df()` an alternative version of pandas `describe()` function
80
- - `pivot_df()` gets a pivot table of a 3 column dataframe
80
+ - `pivot_df()` gets a pivot table of a 3 column dataframe (or 2 columns if no weights are given)
81
81
 
82
82
  - `pls` for plotly visualizations
83
83
  - `plot_box()` auto annotated boxplot w/ violin option
@@ -47,7 +47,7 @@ tbl.show_num_df(
47
47
  - `tbl` utilities for table descriptions
48
48
  - 🌟`show_num_df()` displays a table as styled version with additional information
49
49
  - `describe_df()` an alternative version of pandas `describe()` function
50
- - `pivot_df()` gets a pivot table of a 3 column dataframe
50
+ - `pivot_df()` gets a pivot table of a 3 column dataframe (or 2 columns if no weights are given)
51
51
 
52
52
  - `pls` for plotly visualizations
53
53
  - `plot_box()` auto annotated boxplot w/ violin option
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = pandas-plots
3
- version = 0.11.4
3
+ version = 0.11.5
4
4
  author = smeisegeier
5
5
  author_email = dexterDSDo@googlemail.com
6
6
  description = A collection of helper for table handling and vizualization
@@ -30,8 +30,8 @@ install_requires =
30
30
  matplotlib >= 3.8.2
31
31
  matplotlib-venn >= 0.11.10
32
32
  seaborn >= 0.13.2
33
- Jinja2 >= 3.1.3
34
- requests >= 2.31.0
33
+ Jinja2 >= 3.1.4
34
+ requests >= 2.32.0
35
35
  numpy < 2.0.0
36
36
 
37
37
  [egg_info]
@@ -4,6 +4,10 @@ import scipy.stats
4
4
  import importlib.metadata as md
5
5
  from platform import python_version
6
6
 
7
+ from enum import Enum, auto
8
+ import platform
9
+ import os
10
+
7
11
  from io import BytesIO
8
12
  from matplotlib import pyplot as plt
9
13
  from PIL import Image
@@ -284,4 +288,43 @@ def show_package_version(packages: list[str] = ["pandas","numpy","duckdb","panda
284
288
  items.append(f"📦 {item}: {version}")
285
289
  except md.PackageNotFoundError:
286
290
  items.append(f"❌ {item}: Package not found")
287
- print(sep.join(items))
291
+ print(sep.join(items))
292
+
293
+ from enum import Enum, auto
294
+ import pandas as pd
295
+ from typing import Literal
296
+ import platform
297
+ import os
298
+
299
+ class OperatingSystem(Enum):
300
+ WINDOWS = auto()
301
+ LINUX = auto()
302
+ MAC = auto()
303
+
304
+ def get_os(desired_os: OperatingSystem = None) -> bool:
305
+ """
306
+ A function that checks the operating system and returns a boolean value based on the desired operating system.
307
+
308
+ Parameters:
309
+ desired_os (OperatingSystem): The desired operating system to check against. Defaults to None.
310
+ Values are
311
+ - OperatingSystem.WINDOWS
312
+ - OperatingSystem.LINUX
313
+ - OperatingSystem.MAC
314
+
315
+ Returns:
316
+ bool: True if the desired operating system matches the current operating system, False otherwise. Returns None if desired_os is None.
317
+ """
318
+ print(f'💻 os: {os.name} | 🎯 system: {platform.system()} | 💽 release: {platform.release()}')
319
+
320
+ if desired_os is None:
321
+ return None
322
+
323
+ if desired_os == OperatingSystem.WINDOWS and platform.system() == 'Windows':
324
+ return True
325
+ elif desired_os == OperatingSystem.LINUX and platform.system() == 'Linux':
326
+ return True
327
+ elif desired_os == OperatingSystem.MAC and platform.system() == 'Darwin':
328
+ return True
329
+ else:
330
+ return False
@@ -229,6 +229,10 @@ def pivot_df(
229
229
  A function to pivot a DataFrame based on specified parameters hand over to the *show_num_df* function.
230
230
  It does not provide much added value since the built-in pivot_table function does the same thing.
231
231
  However, it can be useful in certain situations (applying top_n_index and top_n_columns).
232
+
233
+ First two must be [index] and [columns]
234
+ If 3 columns are given, last one must be the weights column.
235
+ If 2 columns are given, column 3 will be added as flat count.
232
236
 
233
237
  Args:
234
238
  df (pd.DataFrame): The input DataFrame to be pivoted.
@@ -262,6 +266,10 @@ def pivot_df(
262
266
  print(f"❌ axis not supported")
263
267
  return
264
268
 
269
+ # * if only 2 are provided, add cnt col
270
+ if len(df.columns) == 2:
271
+ df = df.assign(cnt=1)
272
+
265
273
  if len(df.columns) != 3:
266
274
  print("❌ df must have exactly 3 columns")
267
275
  return
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pandas-plots
3
- Version: 0.11.4
3
+ Version: 0.11.5
4
4
  Summary: A collection of helper for table handling and vizualization
5
5
  Home-page: https://github.com/smeisegeier/pandas-plots
6
6
  Author: smeisegeier
@@ -24,8 +24,8 @@ Requires-Dist: plotly>=5.18.0
24
24
  Requires-Dist: matplotlib>=3.8.2
25
25
  Requires-Dist: matplotlib-venn>=0.11.10
26
26
  Requires-Dist: seaborn>=0.13.2
27
- Requires-Dist: Jinja2>=3.1.3
28
- Requires-Dist: requests>=2.31.0
27
+ Requires-Dist: Jinja2>=3.1.4
28
+ Requires-Dist: requests>=2.32.0
29
29
  Requires-Dist: numpy<2.0.0
30
30
 
31
31
  # pandas-plots
@@ -77,7 +77,7 @@ tbl.show_num_df(
77
77
  - `tbl` utilities for table descriptions
78
78
  - 🌟`show_num_df()` displays a table as styled version with additional information
79
79
  - `describe_df()` an alternative version of pandas `describe()` function
80
- - `pivot_df()` gets a pivot table of a 3 column dataframe
80
+ - `pivot_df()` gets a pivot table of a 3 column dataframe (or 2 columns if no weights are given)
81
81
 
82
82
  - `pls` for plotly visualizations
83
83
  - `plot_box()` auto annotated boxplot w/ violin option
@@ -3,6 +3,6 @@ plotly>=5.18.0
3
3
  matplotlib>=3.8.2
4
4
  matplotlib-venn>=0.11.10
5
5
  seaborn>=0.13.2
6
- Jinja2>=3.1.3
7
- requests>=2.31.0
6
+ Jinja2>=3.1.4
7
+ requests>=2.32.0
8
8
  numpy<2.0.0
File without changes