dycw-utilities 0.153.9__py3-none-any.whl → 0.153.11__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dycw-utilities
3
- Version: 0.153.9
3
+ Version: 0.153.11
4
4
  Author-email: Derek Wan <d.wan@icloud.com>
5
5
  License-File: LICENSE
6
6
  Requires-Python: >=3.12
@@ -12,7 +12,7 @@ Provides-Extra: logging
12
12
  Requires-Dist: coloredlogs<15.1,>=15.0.1; extra == 'logging'
13
13
  Provides-Extra: test
14
14
  Requires-Dist: dycw-pytest-only<2.2,>=2.1.1; extra == 'test'
15
- Requires-Dist: hypothesis<6.137,>=6.136.6; extra == 'test'
15
+ Requires-Dist: hypothesis<6.137,>=6.136.7; extra == 'test'
16
16
  Requires-Dist: pudb<2025.2,>=2025.1; extra == 'test'
17
17
  Requires-Dist: pytest-asyncio<1.2,>=1.1.0; extra == 'test'
18
18
  Requires-Dist: pytest-cov<6.3,>=6.2.1; extra == 'test'
@@ -1,4 +1,4 @@
1
- utilities/__init__.py,sha256=97VHXHiuqPdiW1o-h-8VKH_2VXs7o8z1n7aAh3y_Gf8,60
1
+ utilities/__init__.py,sha256=baiWzrUCQuqlu9VLIW7YjMo7NGhrT0s3Aw0h0sq7eqk,61
2
2
  utilities/altair.py,sha256=92E2lCdyHY4Zb-vCw6rEJIsWdKipuu-Tu2ab1ufUfAk,9079
3
3
  utilities/asyncio.py,sha256=QXkTtugXkqtYt7Do23zgYErqzdp6jwzPpV_SP9fJ1gI,16780
4
4
  utilities/atomicwrites.py,sha256=tPo6r-Rypd9u99u66B9z86YBPpnLrlHtwox_8Z7T34Y,5790
@@ -45,7 +45,7 @@ utilities/parse.py,sha256=JcJn5yXKhIWXBCwgBdPsyu7Hvcuw6kyEdqvaebCaI9k,17951
45
45
  utilities/pathlib.py,sha256=qGuU8XPmdgGpy8tOMUgelfXx3kxI8h9IaV3TI_06QGE,8428
46
46
  utilities/pickle.py,sha256=MBT2xZCsv0pH868IXLGKnlcqNx2IRVKYNpRcqiQQqxw,653
47
47
  utilities/platform.py,sha256=pTn7gw6N4T6LdKrf0virwarof_mze9WtoQlrGMzhGVI,2798
48
- utilities/polars.py,sha256=jNUs038dJMZ0-r3rmHFClIzHlx3naA9klgYBvRDJi9w,77738
48
+ utilities/polars.py,sha256=wuZy0Mgn754b695oNsP0VQDTMwmS-b38wfCyn5aeNi4,78384
49
49
  utilities/polars_ols.py,sha256=Uc9V5kvlWZ5cU93lKZ-cfAKdVFFw81tqwLW9PxtUvMs,5618
50
50
  utilities/postgres.py,sha256=ynCTTaF-bVEOSW-KEAR-dlLh_hYjeVVjm__-4pEU8Zk,12269
51
51
  utilities/pottery.py,sha256=HJ96oLRarTP37Vhg0WTyB3yAu2hETeg6HgRmpDIqyUs,6581
@@ -87,8 +87,8 @@ utilities/zoneinfo.py,sha256=FBMcUQ4662Aq8SsuCL1OAhDQiyANmVjtb-C30DRrWoE,1966
87
87
  utilities/pytest_plugins/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
88
88
  utilities/pytest_plugins/pytest_randomly.py,sha256=B1qYVlExGOxTywq2r1SMi5o7btHLk2PNdY_b1p98dkE,409
89
89
  utilities/pytest_plugins/pytest_regressions.py,sha256=9v8kAXDM2ycIXJBimoiF4EgrwbUvxTycFWJiGR_GHhM,1466
90
- dycw_utilities-0.153.9.dist-info/METADATA,sha256=YnfLnVZv8KS7_AavfEnWypjDwg03Qb5L6Og1gzm8Stg,1696
91
- dycw_utilities-0.153.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
92
- dycw_utilities-0.153.9.dist-info/entry_points.txt,sha256=BOD_SoDxwsfJYOLxhrSXhHP_T7iw-HXI9f2WVkzYxvQ,135
93
- dycw_utilities-0.153.9.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
94
- dycw_utilities-0.153.9.dist-info/RECORD,,
90
+ dycw_utilities-0.153.11.dist-info/METADATA,sha256=x-k8LzJW8mj7s4N679Z6aDgU0xA8hkd31UDz_iREWQs,1697
91
+ dycw_utilities-0.153.11.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
92
+ dycw_utilities-0.153.11.dist-info/entry_points.txt,sha256=BOD_SoDxwsfJYOLxhrSXhHP_T7iw-HXI9f2WVkzYxvQ,135
93
+ dycw_utilities-0.153.11.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
94
+ dycw_utilities-0.153.11.dist-info/RECORD,,
utilities/__init__.py CHANGED
@@ -1,3 +1,3 @@
1
1
  from __future__ import annotations
2
2
 
3
- __version__ = "0.153.9"
3
+ __version__ = "0.153.11"
utilities/polars.py CHANGED
@@ -114,6 +114,7 @@ if TYPE_CHECKING:
114
114
  JoinValidation,
115
115
  PolarsDataType,
116
116
  QuantileMethod,
117
+ RoundMode,
117
118
  SchemaDict,
118
119
  TimeUnit,
119
120
  )
@@ -2365,6 +2366,29 @@ def _reconstruct_dtype(obj: _DeconDType, /) -> PolarsDataType:
2365
2366
  ##
2366
2367
 
2367
2368
 
2369
+ @overload
2370
+ def round_to_float(
2371
+ x: ExprLike, y: float, /, *, mode: RoundMode = "half_to_even"
2372
+ ) -> Expr: ...
2373
+ @overload
2374
+ def round_to_float(
2375
+ x: Series, y: float, /, *, mode: RoundMode = "half_to_even"
2376
+ ) -> Series: ...
2377
+ @overload
2378
+ def round_to_float(
2379
+ x: IntoExprColumn, y: float, /, *, mode: RoundMode = "half_to_even"
2380
+ ) -> ExprOrSeries: ...
2381
+ def round_to_float(
2382
+ x: IntoExprColumn, y: float, /, *, mode: RoundMode = "half_to_even"
2383
+ ) -> ExprOrSeries:
2384
+ """Round a column to the nearest multiple of another float."""
2385
+ x = ensure_expr_or_series(x)
2386
+ return (x / y).round(mode=mode) * y
2387
+
2388
+
2389
+ ##
2390
+
2391
+
2368
2392
  def set_first_row_as_columns(df: DataFrame, /) -> DataFrame:
2369
2393
  """Set the first row of a DataFrame as its columns."""
2370
2394
  try:
@@ -2652,6 +2676,7 @@ __all__ = [
2652
2676
  "read_dataframe",
2653
2677
  "read_series",
2654
2678
  "replace_time_zone",
2679
+ "round_to_float",
2655
2680
  "serialize_dataframe",
2656
2681
  "set_first_row_as_columns",
2657
2682
  "struct_dtype",