onekit 2.1.0__tar.gz → 2.2.0__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.
- {onekit-2.1.0 → onekit-2.2.0}/PKG-INFO +7 -6
- {onekit-2.1.0 → onekit-2.2.0}/README.md +1 -1
- {onekit-2.1.0 → onekit-2.2.0}/pyproject.toml +4 -4
- {onekit-2.1.0 → onekit-2.2.0}/src/onekit/sparkkit.py +4 -4
- {onekit-2.1.0 → onekit-2.2.0}/src/onekit/vizkit.py +62 -0
- {onekit-2.1.0 → onekit-2.2.0}/LICENSE +0 -0
- {onekit-2.1.0 → onekit-2.2.0}/src/onekit/__init__.py +0 -0
- {onekit-2.1.0 → onekit-2.2.0}/src/onekit/dekit.py +0 -0
- {onekit-2.1.0 → onekit-2.2.0}/src/onekit/mathkit.py +0 -0
- {onekit-2.1.0 → onekit-2.2.0}/src/onekit/numpykit.py +0 -0
- {onekit-2.1.0 → onekit-2.2.0}/src/onekit/optfunckit.py +0 -0
- {onekit-2.1.0 → onekit-2.2.0}/src/onekit/pandaskit.py +0 -0
- {onekit-2.1.0 → onekit-2.2.0}/src/onekit/pythonkit.py +0 -0
- {onekit-2.1.0 → onekit-2.2.0}/src/onekit/sklearnkit.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: onekit
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.2.0
|
|
4
4
|
Summary: All-in-One Python Kit.
|
|
5
5
|
License: BSD 3-Clause
|
|
6
6
|
Keywords: onekit
|
|
@@ -11,12 +11,13 @@ Classifier: Programming Language :: Python :: 3 :: Only
|
|
|
11
11
|
Classifier: Programming Language :: Python :: 3.11
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.12
|
|
13
13
|
Provides-Extra: analytics
|
|
14
|
-
Provides-Extra:
|
|
14
|
+
Provides-Extra: base
|
|
15
|
+
Provides-Extra: pyspark
|
|
15
16
|
Requires-Dist: pandas[compression,computation,excel,output-formatting,parquet,performance,plot] (>=2.2.3,<3.0.0) ; extra == "analytics"
|
|
16
|
-
Requires-Dist: pyspark (==3.5.3) ; extra == "
|
|
17
|
-
Requires-Dist: pytz (>=2025.2,<2026.0) ; extra == "
|
|
17
|
+
Requires-Dist: pyspark (==3.5.3) ; extra == "pyspark"
|
|
18
|
+
Requires-Dist: pytz (>=2025.2,<2026.0) ; extra == "base"
|
|
18
19
|
Requires-Dist: scikit-learn (>=1.6.1,<2.0.0) ; extra == "analytics"
|
|
19
|
-
Requires-Dist: toolz (>=1.0.0,<2.0.0) ; extra == "
|
|
20
|
+
Requires-Dist: toolz (>=1.0.0,<2.0.0) ; extra == "base"
|
|
20
21
|
Requires-Dist: tqdm (>=4.67.1,<5.0.0) ; extra == "analytics"
|
|
21
22
|
Description-Content-Type: text/markdown
|
|
22
23
|
|
|
@@ -53,7 +54,7 @@ pip install onekit
|
|
|
53
54
|
With optional dependencies:
|
|
54
55
|
|
|
55
56
|
```shell
|
|
56
|
-
pip install onekit[
|
|
57
|
+
pip install onekit[base,analytics,pyspark]
|
|
57
58
|
```
|
|
58
59
|
|
|
59
60
|
## Disclaimer
|
|
@@ -22,10 +22,10 @@ requires-python = ">=3.11"
|
|
|
22
22
|
dependencies = []
|
|
23
23
|
|
|
24
24
|
[tool.poetry]
|
|
25
|
-
version = "2.
|
|
25
|
+
version = "2.2.0"
|
|
26
26
|
|
|
27
27
|
[project.optional-dependencies]
|
|
28
|
-
|
|
28
|
+
base = [
|
|
29
29
|
"toolz (>=1.0.0,<2.0.0)",
|
|
30
30
|
"pytz (>=2025.2,<2026.0)",
|
|
31
31
|
]
|
|
@@ -33,12 +33,12 @@ analytics = [
|
|
|
33
33
|
"pandas[compression,computation,excel,output-formatting,parquet,performance,plot] (>=2.2.3,<3.0.0)",
|
|
34
34
|
"scikit-learn (>=1.6.1,<2.0.0)",
|
|
35
35
|
"tqdm (>=4.67.1,<5.0.0)",
|
|
36
|
-
"pyspark (==3.5.3)",
|
|
37
36
|
]
|
|
37
|
+
pyspark = ["pyspark (==3.5.3)"]
|
|
38
38
|
|
|
39
39
|
[tool.poetry.group.dev.dependencies]
|
|
40
40
|
autoflake = "^2.3.1"
|
|
41
|
-
black = {extras = ["jupyter"], version = "^25.1.0"}
|
|
41
|
+
black = { extras = ["jupyter"], version = "^25.1.0" }
|
|
42
42
|
isort = "^6.0.1"
|
|
43
43
|
flake8 = "^7.1.2"
|
|
44
44
|
pre-commit = "^4.2.0"
|
|
@@ -1104,8 +1104,8 @@ def with_date_diff_ago(
|
|
|
1104
1104
|
ref_date: str | dt.date,
|
|
1105
1105
|
new_col: str,
|
|
1106
1106
|
) -> SparkDF:
|
|
1107
|
-
"""Add column
|
|
1108
|
-
where
|
|
1107
|
+
"""Add a column showing date differences with respect to the reference date,
|
|
1108
|
+
where differences to past dates are positive integers.
|
|
1109
1109
|
|
|
1110
1110
|
Examples
|
|
1111
1111
|
--------
|
|
@@ -1150,8 +1150,8 @@ def with_date_diff_ahead(
|
|
|
1150
1150
|
ref_date: str | dt.date,
|
|
1151
1151
|
new_col: str,
|
|
1152
1152
|
) -> SparkDF:
|
|
1153
|
-
"""Add column
|
|
1154
|
-
where
|
|
1153
|
+
"""Add a column showing date differences with respect to the reference date,
|
|
1154
|
+
where differences to future dates are positive integers.
|
|
1155
1155
|
|
|
1156
1156
|
Examples
|
|
1157
1157
|
--------
|
|
@@ -13,6 +13,7 @@ from mpl_toolkits.axes_grid1 import make_axes_locatable
|
|
|
13
13
|
from mpl_toolkits.mplot3d.axes3d import Axes3D
|
|
14
14
|
|
|
15
15
|
from onekit import numpykit as npk
|
|
16
|
+
from onekit import pythonkit as pk
|
|
16
17
|
|
|
17
18
|
__all__ = (
|
|
18
19
|
"Config",
|
|
@@ -21,6 +22,7 @@ __all__ = (
|
|
|
21
22
|
"create_xyz_points",
|
|
22
23
|
"discrete_cmap",
|
|
23
24
|
"plot_contour",
|
|
25
|
+
"plot_digitscale",
|
|
24
26
|
"plot_line",
|
|
25
27
|
"plot_surface",
|
|
26
28
|
"plot_xy_points",
|
|
@@ -481,6 +483,66 @@ def plot_contour(
|
|
|
481
483
|
return ax
|
|
482
484
|
|
|
483
485
|
|
|
486
|
+
def plot_digitscale(
|
|
487
|
+
x,
|
|
488
|
+
/,
|
|
489
|
+
*,
|
|
490
|
+
cmap_name: str = "YlOrBr_r",
|
|
491
|
+
kws_plot: dict[str, str] | None = None,
|
|
492
|
+
ax=None,
|
|
493
|
+
) -> Axes:
|
|
494
|
+
"""Plot a scaled version of :math:`x` using digitscale.
|
|
495
|
+
|
|
496
|
+
See Also
|
|
497
|
+
--------
|
|
498
|
+
onekit.mathkit.digitscale : Python version
|
|
499
|
+
|
|
500
|
+
Examples
|
|
501
|
+
--------
|
|
502
|
+
>>> from onekit import mathkit as mk
|
|
503
|
+
>>> from onekit import vizkit as vk
|
|
504
|
+
>>> vk.plot_digitscale(tuple(mk.collatz(27))) # doctest: +SKIP
|
|
505
|
+
"""
|
|
506
|
+
ax = ax or plt.gca()
|
|
507
|
+
|
|
508
|
+
kwargs_plot = dict(marker=".", color="black")
|
|
509
|
+
kwargs_plot.update(kws_plot or dict())
|
|
510
|
+
|
|
511
|
+
x_values = np.asarray(x)
|
|
512
|
+
x_scaled = npk.digitscale(x_values)
|
|
513
|
+
ax.plot(x_scaled, **kwargs_plot)
|
|
514
|
+
x_limits = ax.get_xlim()
|
|
515
|
+
|
|
516
|
+
y_min = int(np.floor(x_scaled.min()))
|
|
517
|
+
y_max = int(np.ceil(x_scaled.max()))
|
|
518
|
+
y_range = tuple(range(y_min, y_max))
|
|
519
|
+
colors = discrete_cmap(y_max, name=cmap_name, lower_bound=0.2, upper_bound=0.8)
|
|
520
|
+
|
|
521
|
+
for i, y in enumerate(y_range):
|
|
522
|
+
ax.fill_between(x_limits, y, y + 1, color=colors[i], alpha=0.3)
|
|
523
|
+
|
|
524
|
+
ax.set_xlim(x_limits)
|
|
525
|
+
ax.set_yticks(y_range)
|
|
526
|
+
|
|
527
|
+
ax.set_xlabel("index")
|
|
528
|
+
ax.set_ylabel("num_digits(orig_value)")
|
|
529
|
+
|
|
530
|
+
ax.set_title(
|
|
531
|
+
pk.concat_strings(
|
|
532
|
+
", ",
|
|
533
|
+
f"mean={pk.num_to_str(x_values.mean())}",
|
|
534
|
+
f"median={pk.num_to_str(float(np.median(x_values)))}",
|
|
535
|
+
f"std={pk.num_to_str(x_values.std(ddof=1))}",
|
|
536
|
+
f"min={pk.num_to_str(x_values.min())}",
|
|
537
|
+
f"max={pk.num_to_str(x_values.max())}",
|
|
538
|
+
),
|
|
539
|
+
size="medium",
|
|
540
|
+
pad=12,
|
|
541
|
+
)
|
|
542
|
+
|
|
543
|
+
return ax
|
|
544
|
+
|
|
545
|
+
|
|
484
546
|
def plot_line(xy_pts: XyPoints, /, *, kws_plot=None, ax=None) -> Axes:
|
|
485
547
|
"""Plot :math:`y` versus :math:`x` as line.
|
|
486
548
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|