dycw-utilities 0.158.2__py3-none-any.whl → 0.159.1__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.158.2
3
+ Version: 0.159.1
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.138,>=6.137.1; extra == 'test'
15
+ Requires-Dist: hypothesis<6.139,>=6.138.0; extra == 'test'
16
16
  Requires-Dist: pytest-asyncio<1.2,>=1.1.0; extra == 'test'
17
17
  Requires-Dist: pytest-cov<6.3,>=6.2.1; extra == 'test'
18
18
  Requires-Dist: pytest-instafail<0.6,>=0.5.0; extra == 'test'
@@ -1,4 +1,4 @@
1
- utilities/__init__.py,sha256=jZQwkUNy9TN26VVw3BQw14Odj6HwpuCsgilpBwksDU4,60
1
+ utilities/__init__.py,sha256=Sn6930zXuSe3WGJ5qrzIW92IebaarjXcUx0osmO7Hsk,60
2
2
  utilities/altair.py,sha256=92E2lCdyHY4Zb-vCw6rEJIsWdKipuu-Tu2ab1ufUfAk,9079
3
3
  utilities/asyncio.py,sha256=PUedzQ5deqlSECQ33sam9cRzI9TnygHz3FdOqWJWPTM,15288
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=JOZjSpj9jitDijX044mKc-N00C5N_On3TJYJKJRhdcE,78494
48
+ utilities/polars.py,sha256=qgk9TXHrHodUsgevDbtglYtiZ8jZ-PT8y4EyfU4fk9U,76772
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=ggMN72Y7wx7Js8VN6eyNyodpm8TIYqZHGghkDPXIVWk,3949
@@ -54,7 +54,7 @@ utilities/psutil.py,sha256=KUlu4lrUw9Zg1V7ZGetpWpGb9DB8l_SSDWGbANFNCPU,2104
54
54
  utilities/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
55
55
  utilities/pyinstrument.py,sha256=NZCZz2nBo0BLJ9DTf7H_Q_KGxvsf2S2M3h0qYoYh2kw,804
56
56
  utilities/pytest.py,sha256=M-Om6b3hpF9W_bEB7UFY2IzBCubSxzVQleGrgRXHtxY,7741
57
- utilities/pytest_regressions.py,sha256=8by5DWEL89Y469TI5AzX1pMy3NJWVtjEg2xQdOOdYuM,4169
57
+ utilities/pytest_regressions.py,sha256=ocjHTtfOeiGfQAKIei8pKNd61sxN9dawrJJ9gPt2wzA,4097
58
58
  utilities/random.py,sha256=hZlH4gnAtoaofWswuJYjcygejrY8db4CzP-z_adO2Mo,4165
59
59
  utilities/re.py,sha256=S4h-DLL6ScMPqjboZ_uQ1BVTJajrqV06r_81D--_HCE,4573
60
60
  utilities/redis.py,sha256=pqzl5A08vaRS4Gfjxob3LWWH9c-vwlsKbvVMTjWMSh8,28364
@@ -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.158.2.dist-info/METADATA,sha256=obAnKM-ELyfwb4R4ujBYwTxLDgAgCQjFu5lQxUwri38,1643
91
- dycw_utilities-0.158.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
92
- dycw_utilities-0.158.2.dist-info/entry_points.txt,sha256=BOD_SoDxwsfJYOLxhrSXhHP_T7iw-HXI9f2WVkzYxvQ,135
93
- dycw_utilities-0.158.2.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
94
- dycw_utilities-0.158.2.dist-info/RECORD,,
90
+ dycw_utilities-0.159.1.dist-info/METADATA,sha256=CxCbx_EE_zO3iemn0g8u__516dCh1gbwoQCSZZ7ZEcE,1643
91
+ dycw_utilities-0.159.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
92
+ dycw_utilities-0.159.1.dist-info/entry_points.txt,sha256=BOD_SoDxwsfJYOLxhrSXhHP_T7iw-HXI9f2WVkzYxvQ,135
93
+ dycw_utilities-0.159.1.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
94
+ dycw_utilities-0.159.1.dist-info/RECORD,,
utilities/__init__.py CHANGED
@@ -1,3 +1,3 @@
1
1
  from __future__ import annotations
2
2
 
3
- __version__ = "0.158.2"
3
+ __version__ = "0.159.1"
utilities/polars.py CHANGED
@@ -3,7 +3,6 @@ from __future__ import annotations
3
3
  import enum
4
4
  from collections.abc import Callable, Iterator, Sequence
5
5
  from collections.abc import Set as AbstractSet
6
- from contextlib import suppress
7
6
  from dataclasses import asdict, dataclass
8
7
  from functools import partial, reduce
9
8
  from itertools import chain, pairwise, product
@@ -43,9 +42,9 @@ from polars import (
43
42
  from polars._typing import PolarsDataType
44
43
  from polars.datatypes import DataType, DataTypeClass
45
44
  from polars.exceptions import (
46
- ColumnNotFoundError, # pyright: ignore[reportAttributeAccessIssue]
45
+ ColumnNotFoundError,
47
46
  NoRowsReturnedError,
48
- OutOfBoundsError, # pyright: ignore[reportAttributeAccessIssue]
47
+ OutOfBoundsError,
49
48
  PolarsInefficientMapWarning,
50
49
  )
51
50
  from polars.schema import Schema
@@ -59,7 +58,6 @@ from utilities.functions import (
59
58
  ensure_int,
60
59
  is_dataclass_class,
61
60
  is_dataclass_instance,
62
- is_iterable_of,
63
61
  make_isinstance,
64
62
  )
65
63
  from utilities.gzip import read_binary
@@ -91,7 +89,6 @@ from utilities.reprlib import get_repr
91
89
  from utilities.types import MaybeStr, Number, PathLike, WeekDay
92
90
  from utilities.typing import (
93
91
  get_args,
94
- get_type_hints,
95
92
  is_frozenset_type,
96
93
  is_list_type,
97
94
  is_literal_type,
@@ -340,8 +337,8 @@ def are_frames_equal(
340
337
  check_column_order: bool = True,
341
338
  check_dtypes: bool = True,
342
339
  check_exact: bool = False,
343
- rtol: float = 1e-5,
344
- atol: float = 1e-8,
340
+ rel_tol: float = 1e-5,
341
+ abs_tol: float = 1e-8,
345
342
  categorical_as_str: bool = False,
346
343
  ) -> bool:
347
344
  """Check if two DataFrames are equal."""
@@ -353,8 +350,8 @@ def are_frames_equal(
353
350
  check_column_order=check_column_order,
354
351
  check_dtypes=check_dtypes,
355
352
  check_exact=check_exact,
356
- rtol=rtol,
357
- atol=atol,
353
+ rel_tol=rel_tol,
354
+ abs_tol=abs_tol,
358
355
  categorical_as_str=categorical_as_str,
359
356
  )
360
357
  except AssertionError:
@@ -786,15 +783,6 @@ def choice(
786
783
  ##
787
784
 
788
785
 
789
- def collect_series(expr: Expr, /) -> Series:
790
- """Collect a column expression into a Series."""
791
- data = DataFrame().with_columns(expr)
792
- return data[one(data.columns)]
793
-
794
-
795
- ##
796
-
797
-
798
786
  def columns_to_dict(df: DataFrame, key: str, value: str, /) -> dict[Any, Any]:
799
787
  """Map a pair of columns into a dictionary. Must be unique on `key`."""
800
788
  col_key = df[key]
@@ -1047,7 +1035,9 @@ def _dataclass_to_dataframe_cast(series: Series, /) -> Series:
1047
1035
  is_path = series.map_elements(make_isinstance(Path), return_dtype=Boolean).all()
1048
1036
  is_uuid = series.map_elements(make_isinstance(UUID), return_dtype=Boolean).all()
1049
1037
  if is_path or is_uuid:
1050
- with suppress_warnings(category=PolarsInefficientMapWarning):
1038
+ with suppress_warnings(
1039
+ category=cast("type[Warning]", PolarsInefficientMapWarning)
1040
+ ):
1051
1041
  return series.map_elements(str, return_dtype=String)
1052
1042
  if series.map_elements(make_isinstance(whenever.Time), return_dtype=Boolean).all():
1053
1043
  return series.map_elements(lambda x: x.py_time(), return_dtype=pl.Time)
@@ -1188,27 +1178,6 @@ def _dataclass_to_schema_one(
1188
1178
  ##
1189
1179
 
1190
1180
 
1191
- def drop_null_struct_series(series: Series, /) -> Series:
1192
- """Drop nulls in a struct-dtype Series as per the <= 1.1 definition."""
1193
- try:
1194
- is_not_null = is_not_null_struct_series(series)
1195
- except IsNotNullStructSeriesError as error:
1196
- raise DropNullStructSeriesError(series=error.series) from None
1197
- return series.filter(is_not_null)
1198
-
1199
-
1200
- @dataclass(kw_only=True, slots=True)
1201
- class DropNullStructSeriesError(Exception):
1202
- series: Series
1203
-
1204
- @override
1205
- def __str__(self) -> str:
1206
- return f"Series must have Struct-dtype; got {self.series.dtype}"
1207
-
1208
-
1209
- ##
1210
-
1211
-
1212
1181
  def ensure_data_type(dtype: PolarsDataType, /) -> DataType:
1213
1182
  """Ensure a data type is returned."""
1214
1183
  return dtype if isinstance(dtype, DataType) else dtype()
@@ -1243,6 +1212,14 @@ def ensure_expr_or_series_many(
1243
1212
  ##
1244
1213
 
1245
1214
 
1215
+ def expr_to_series(expr: Expr, /) -> Series:
1216
+ """Collect a column expression into a Series."""
1217
+ return one_column(DataFrame().with_columns(expr))
1218
+
1219
+
1220
+ ##
1221
+
1222
+
1246
1223
  @overload
1247
1224
  def finite_ewm_mean(
1248
1225
  column: ExprLike,
@@ -1417,8 +1394,7 @@ def get_expr_name(obj: Series | DataFrame, expr: IntoExprColumn, /) -> str:
1417
1394
  case Series() as series:
1418
1395
  return get_expr_name(series.to_frame(), expr)
1419
1396
  case DataFrame() as df:
1420
- selected = df.select(expr)
1421
- return one(selected.columns)
1397
+ return one_column(df.select(expr)).name
1422
1398
  case never:
1423
1399
  assert_never(never)
1424
1400
 
@@ -1718,68 +1694,28 @@ class _IsNearEventAfterError(IsNearEventError):
1718
1694
  ##
1719
1695
 
1720
1696
 
1721
- def is_not_null_struct_series(series: Series, /) -> Series:
1722
- """Check if a struct-dtype Series is not null as per the <= 1.1 definition."""
1723
- try:
1724
- return ~is_null_struct_series(series)
1725
- except IsNullStructSeriesError as error:
1726
- raise IsNotNullStructSeriesError(series=error.series) from None
1727
-
1728
-
1729
- @dataclass(kw_only=True, slots=True)
1730
- class IsNotNullStructSeriesError(Exception):
1731
- series: Series
1732
-
1733
- @override
1734
- def __str__(self) -> str:
1735
- return f"Series must have Struct-dtype; got {self.series.dtype}"
1736
-
1737
-
1738
- ##
1739
-
1740
-
1741
- def is_null_struct_series(series: Series, /) -> Series:
1742
- """Check if a struct-dtype Series is null as per the <= 1.1 definition."""
1743
- if not isinstance(series.dtype, Struct):
1744
- raise IsNullStructSeriesError(series=series)
1745
- paths = _is_null_struct_series_one(series.dtype)
1746
- paths = list(paths)
1747
- exprs = map(_is_null_struct_to_expr, paths)
1748
- expr = all_horizontal(*exprs)
1749
- return (
1750
- series.struct.unnest().with_columns(_result=expr)["_result"].rename(series.name)
1751
- )
1752
-
1753
-
1754
- def _is_null_struct_series_one(
1755
- dtype: Struct, /, *, root: Iterable[str] = ()
1756
- ) -> Iterator[Sequence[str]]:
1757
- for field in dtype.fields:
1758
- name = field.name
1759
- inner = field.dtype
1760
- path = list(chain(root, [name]))
1761
- if isinstance(inner, Struct):
1762
- yield from _is_null_struct_series_one(inner, root=path)
1763
- else:
1764
- yield path
1765
-
1766
-
1767
- def _is_null_struct_to_expr(path: Iterable[str], /) -> Expr:
1768
- head, *tail = path
1769
- return reduce(_is_null_struct_to_expr_reducer, tail, col(head)).is_null()
1770
-
1771
-
1772
- def _is_null_struct_to_expr_reducer(expr: Expr, path: str, /) -> Expr:
1773
- return expr.struct[path]
1697
+ @overload
1698
+ def is_true(column: ExprLike, /) -> Expr: ...
1699
+ @overload
1700
+ def is_true(column: Series, /) -> Series: ...
1701
+ @overload
1702
+ def is_true(column: IntoExprColumn, /) -> ExprOrSeries: ...
1703
+ def is_true(column: IntoExprColumn, /) -> ExprOrSeries:
1704
+ """Compute when a boolean series is True."""
1705
+ column = ensure_expr_or_series(column)
1706
+ return (column.is_not_null()) & column
1774
1707
 
1775
1708
 
1776
- @dataclass(kw_only=True, slots=True)
1777
- class IsNullStructSeriesError(Exception):
1778
- series: Series
1779
-
1780
- @override
1781
- def __str__(self) -> str:
1782
- return f"Series must have Struct-dtype; got {self.series.dtype}"
1709
+ @overload
1710
+ def is_false(column: ExprLike, /) -> Expr: ...
1711
+ @overload
1712
+ def is_false(column: Series, /) -> Series: ...
1713
+ @overload
1714
+ def is_false(column: IntoExprColumn, /) -> ExprOrSeries: ...
1715
+ def is_false(column: IntoExprColumn, /) -> ExprOrSeries:
1716
+ """Compute when a boolean series is False."""
1717
+ column = ensure_expr_or_series(column)
1718
+ return (column.is_not_null()) & (~column)
1783
1719
 
1784
1720
 
1785
1721
  ##
@@ -2053,6 +1989,43 @@ def offset_datetime(
2053
1989
  ##
2054
1990
 
2055
1991
 
1992
+ def one_column(df: DataFrame, /) -> Series:
1993
+ """Return the unique column in a DataFrame."""
1994
+ try:
1995
+ return df[one(df.columns)]
1996
+ except OneEmptyError:
1997
+ raise OneColumnEmptyError(df=df) from None
1998
+ except OneNonUniqueError as error:
1999
+ raise OneColumnNonUniqueError(
2000
+ df=df, first=error.first, second=error.second
2001
+ ) from None
2002
+
2003
+
2004
+ @dataclass(kw_only=True, slots=True)
2005
+ class OneColumnError(Exception):
2006
+ df: DataFrame
2007
+
2008
+
2009
+ @dataclass(kw_only=True, slots=True)
2010
+ class OneColumnEmptyError(OneColumnError):
2011
+ @override
2012
+ def __str__(self) -> str:
2013
+ return "DataFrame must not be empty"
2014
+
2015
+
2016
+ @dataclass(kw_only=True, slots=True)
2017
+ class OneColumnNonUniqueError(OneColumnError):
2018
+ first: str
2019
+ second: str
2020
+
2021
+ @override
2022
+ def __str__(self) -> str:
2023
+ return f"DataFrame must contain exactly one column; got {self.first!r}, {self.second!r} and perhaps more"
2024
+
2025
+
2026
+ ##
2027
+
2028
+
2056
2029
  @overload
2057
2030
  def order_of_magnitude(column: ExprLike, /, *, round_: bool = False) -> Expr: ...
2058
2031
  @overload
@@ -2174,13 +2147,10 @@ def reify_exprs(
2174
2147
  .with_columns(*all_exprs)
2175
2148
  .drop("_index")
2176
2149
  )
2177
- match len(df.columns):
2178
- case 0:
2179
- raise ImpossibleCaseError(case=[f"{df.columns=}"]) # pragma: no cover
2180
- case 1:
2181
- return df[one(df.columns)]
2182
- case _:
2183
- return df
2150
+ try:
2151
+ return one_column(df)
2152
+ except OneColumnNonUniqueError:
2153
+ return df
2184
2154
 
2185
2155
 
2186
2156
  @dataclass(kw_only=True, slots=True)
@@ -2408,74 +2378,52 @@ def struct_dtype(**kwargs: PolarsDataType) -> Struct:
2408
2378
  ##
2409
2379
 
2410
2380
 
2411
- def struct_from_dataclass(
2412
- cls: type[Dataclass],
2413
- /,
2414
- *,
2415
- globalns: StrMapping | None = None,
2416
- localns: StrMapping | None = None,
2417
- warn_name_errors: bool = False,
2418
- time_zone: TimeZoneLike | None = None,
2419
- ) -> Struct:
2420
- """Construct the Struct data type for a dataclass."""
2421
- if not is_dataclass_class(cls):
2422
- raise _StructFromDataClassNotADataclassError(cls=cls)
2423
- anns = get_type_hints(
2424
- cls, globalns=globalns, localns=localns, warn_name_errors=warn_name_errors
2425
- )
2426
- data_types = {
2427
- k: _struct_from_dataclass_one(v, time_zone=time_zone) for k, v in anns.items()
2428
- }
2429
- return Struct(data_types)
2430
-
2431
-
2432
- def _struct_from_dataclass_one(
2433
- ann: Any, /, *, time_zone: TimeZoneLike | None = None
2434
- ) -> PolarsDataType:
2435
- mapping = {
2436
- bool: Boolean,
2437
- whenever.Date: pl.Date,
2438
- float: Float64,
2439
- int: Int64,
2440
- str: String,
2441
- }
2442
- with suppress(KeyError):
2443
- return mapping[ann]
2444
- if is_dataclass_class(ann):
2445
- return struct_from_dataclass(ann, time_zone=time_zone)
2446
- if (isinstance(ann, type) and issubclass(ann, enum.Enum)) or (
2447
- is_literal_type(ann) and is_iterable_of(get_args(ann), str)
2448
- ):
2449
- return String
2450
- if is_optional_type(ann):
2451
- return _struct_from_dataclass_one(
2452
- one(get_args(ann, optional_drop_none=True)), time_zone=time_zone
2453
- )
2454
- if is_frozenset_type(ann) or is_list_type(ann) or is_set_type(ann):
2455
- return List(_struct_from_dataclass_one(one(get_args(ann)), time_zone=time_zone))
2456
- raise _StructFromDataClassTypeError(ann=ann)
2457
-
2458
-
2459
- @dataclass(kw_only=True, slots=True)
2460
- class StructFromDataClassError(Exception): ...
2381
+ @overload
2382
+ def to_true(column: ExprLike, /) -> Expr: ...
2383
+ @overload
2384
+ def to_true(column: Series, /) -> Series: ...
2385
+ @overload
2386
+ def to_true(column: IntoExprColumn, /) -> ExprOrSeries: ...
2387
+ def to_true(column: IntoExprColumn, /) -> ExprOrSeries:
2388
+ """Compute when a boolean series turns True."""
2389
+ t = is_true(column)
2390
+ return ((~t).shift() & t).fill_null(value=False)
2461
2391
 
2462
2392
 
2463
- @dataclass(kw_only=True, slots=True)
2464
- class _StructFromDataClassNotADataclassError(StructFromDataClassError):
2465
- cls: type[Dataclass]
2393
+ @overload
2394
+ def to_not_true(column: ExprLike, /) -> Expr: ...
2395
+ @overload
2396
+ def to_not_true(column: Series, /) -> Series: ...
2397
+ @overload
2398
+ def to_not_true(column: IntoExprColumn, /) -> ExprOrSeries: ...
2399
+ def to_not_true(column: IntoExprColumn, /) -> ExprOrSeries:
2400
+ """Compute when a boolean series turns non-True."""
2401
+ t = is_true(column)
2402
+ return (t.shift() & (~t)).fill_null(value=False)
2466
2403
 
2467
- @override
2468
- def __str__(self) -> str:
2469
- return f"Object must be a dataclass; got {self.cls}"
2470
2404
 
2405
+ @overload
2406
+ def to_false(column: ExprLike, /) -> Expr: ...
2407
+ @overload
2408
+ def to_false(column: Series, /) -> Series: ...
2409
+ @overload
2410
+ def to_false(column: IntoExprColumn, /) -> ExprOrSeries: ...
2411
+ def to_false(column: IntoExprColumn, /) -> ExprOrSeries:
2412
+ """Compute when a boolean series turns False."""
2413
+ f = is_false(column)
2414
+ return ((~f).shift() & f).fill_null(value=False)
2471
2415
 
2472
- @dataclass(kw_only=True, slots=True)
2473
- class _StructFromDataClassTypeError(StructFromDataClassError):
2474
- ann: Any
2475
2416
 
2476
- @override
2477
- def __str__(self) -> str:
2478
- return f"Unsupported type: {self.ann}"
2417
+ @overload
2418
+ def to_not_false(column: ExprLike, /) -> Expr: ...
2419
+ @overload
2420
+ def to_not_false(column: Series, /) -> Series: ...
2421
+ @overload
2422
+ def to_not_false(column: IntoExprColumn, /) -> ExprOrSeries: ...
2423
+ def to_not_false(column: IntoExprColumn, /) -> ExprOrSeries:
2424
+ """Compute when a boolean series turns non-False."""
2425
+ f = is_false(column)
2426
+ return (f.shift() & (~f)).fill_null(value=False)
2479
2427
 
2480
2428
 
2481
2429
  ##
@@ -2597,7 +2545,6 @@ __all__ = [
2597
2545
  "DatetimeUSCentral",
2598
2546
  "DatetimeUSEastern",
2599
2547
  "DatetimeUTC",
2600
- "DropNullStructSeriesError",
2601
2548
  "ExprOrSeries",
2602
2549
  "FiniteEWMMeanError",
2603
2550
  "GetDataTypeOrSeriesTimeZoneError",
@@ -2606,9 +2553,10 @@ __all__ = [
2606
2553
  "InsertBeforeError",
2607
2554
  "InsertBetweenError",
2608
2555
  "IsNearEventError",
2609
- "IsNullStructSeriesError",
2556
+ "OneColumnEmptyError",
2557
+ "OneColumnError",
2558
+ "OneColumnNonUniqueError",
2610
2559
  "SetFirstRowAsColumnsError",
2611
- "StructFromDataClassError",
2612
2560
  "TimePeriodDType",
2613
2561
  "acf",
2614
2562
  "adjust_frequencies",
@@ -2622,7 +2570,6 @@ __all__ = [
2622
2570
  "boolean_value_counts",
2623
2571
  "check_polars_dataframe",
2624
2572
  "choice",
2625
- "collect_series",
2626
2573
  "columns_to_dict",
2627
2574
  "concat_series",
2628
2575
  "convert_time_zone",
@@ -2631,10 +2578,10 @@ __all__ = [
2631
2578
  "dataclass_to_schema",
2632
2579
  "decreasing_horizontal",
2633
2580
  "deserialize_dataframe",
2634
- "drop_null_struct_series",
2635
2581
  "ensure_data_type",
2636
2582
  "ensure_expr_or_series",
2637
2583
  "ensure_expr_or_series_many",
2584
+ "expr_to_series",
2638
2585
  "finite_ewm_mean",
2639
2586
  "get_data_type_or_series_time_zone",
2640
2587
  "get_expr_name",
@@ -2645,9 +2592,9 @@ __all__ = [
2645
2592
  "insert_before",
2646
2593
  "insert_between",
2647
2594
  "integers",
2595
+ "is_false",
2648
2596
  "is_near_event",
2649
- "is_not_null_struct_series",
2650
- "is_null_struct_series",
2597
+ "is_true",
2651
2598
  "join",
2652
2599
  "join_into_periods",
2653
2600
  "map_over_columns",
@@ -2655,6 +2602,7 @@ __all__ = [
2655
2602
  "nan_sum_cols",
2656
2603
  "normal",
2657
2604
  "offset_datetime",
2605
+ "one_column",
2658
2606
  "order_of_magnitude",
2659
2607
  "period_range",
2660
2608
  "read_dataframe",
@@ -2664,7 +2612,10 @@ __all__ = [
2664
2612
  "serialize_dataframe",
2665
2613
  "set_first_row_as_columns",
2666
2614
  "struct_dtype",
2667
- "struct_from_dataclass",
2615
+ "to_false",
2616
+ "to_not_false",
2617
+ "to_not_true",
2618
+ "to_true",
2668
2619
  "touch",
2669
2620
  "try_reify_expr",
2670
2621
  "uniform",
@@ -91,9 +91,7 @@ class PolarsRegressionFixture:
91
91
  def check(self, obj: Series | DataFrame, /, *, suffix: str | None = None) -> None:
92
92
  """Check the Series/DataFrame summary against the baseline."""
93
93
  from polars import DataFrame, Series, col
94
- from polars.exceptions import (
95
- InvalidOperationError, # pyright: ignore[reportAttributeAccessIssue]
96
- )
94
+ from polars.exceptions import InvalidOperationError
97
95
 
98
96
  data: StrMapping = {
99
97
  "describe": obj.describe(percentiles=[i / 10 for i in range(1, 10)]).rows(