4
4
5
5
6
6
if TYPE_CHECKING :
7
- from ._types import DType
8
- from . import Bool
9
7
from ._types import NullType , Scalar
8
+ from .eagercolumn_object import EagerColumn
10
9
11
10
12
11
__all__ = ['Expression' ]
@@ -92,7 +91,7 @@ def len(self) -> Expression:
92
91
Return the number of rows.
93
92
"""
94
93
95
- def get_rows (self : Expression , indices : Expression ) -> Expression :
94
+ def get_rows (self , indices : Expression | EagerColumn [ Any ] ) -> Expression :
96
95
"""
97
96
Select a subset of rows, similar to `ndarray.take`.
98
97
@@ -104,7 +103,7 @@ def get_rows(self: Expression, indices: Expression) -> Expression:
104
103
...
105
104
106
105
def slice_rows (
107
- self : Expression , start : int | None , stop : int | None , step : int | None
106
+ self , start : int | None , stop : int | None , step : int | None
108
107
) -> Expression :
109
108
"""
110
109
Select a subset of rows corresponding to a slice.
@@ -121,7 +120,7 @@ def slice_rows(
121
120
"""
122
121
...
123
122
124
- def filter (self , mask : Expression ) -> Expression :
123
+ def filter (self , mask : Expression | EagerColumn [ bool ] ) -> Expression :
125
124
"""
126
125
Select a subset of rows corresponding to a mask.
127
126
@@ -225,7 +224,7 @@ def __eq__(self, other: Expression | Scalar) -> Expression: # type: ignore[over
225
224
Expression
226
225
"""
227
226
228
- def __ne__ (self : Expression , other : Expression | Scalar ) -> Expression : # type: ignore[override]
227
+ def __ne__ (self , other : Expression | Scalar ) -> Expression : # type: ignore[override]
229
228
"""
230
229
Compare for non-equality.
231
230
@@ -243,7 +242,7 @@ def __ne__(self: Expression, other: Expression | Scalar) -> Expression: # type:
243
242
Expression
244
243
"""
245
244
246
- def __ge__ (self : Expression , other : Expression | Scalar ) -> Expression :
245
+ def __ge__ (self , other : Expression | Scalar ) -> Expression :
247
246
"""
248
247
Compare for "greater than or equal to" `other`.
249
248
@@ -259,7 +258,7 @@ def __ge__(self: Expression, other: Expression | Scalar) -> Expression:
259
258
Expression
260
259
"""
261
260
262
- def __gt__ (self : Expression , other : Expression | Scalar ) -> Expression :
261
+ def __gt__ (self , other : Expression | Scalar ) -> Expression :
263
262
"""
264
263
Compare for "greater than" `other`.
265
264
@@ -275,7 +274,7 @@ def __gt__(self: Expression, other: Expression | Scalar) -> Expression:
275
274
Expression
276
275
"""
277
276
278
- def __le__ (self : Expression , other : Expression | Scalar ) -> Expression :
277
+ def __le__ (self , other : Expression | Scalar ) -> Expression :
279
278
"""
280
279
Compare for "less than or equal to" `other`.
281
280
@@ -291,7 +290,7 @@ def __le__(self: Expression, other: Expression | Scalar) -> Expression:
291
290
Expression
292
291
"""
293
292
294
- def __lt__ (self : Expression , other : Expression | Scalar ) -> Expression :
293
+ def __lt__ (self , other : Expression | Scalar ) -> Expression :
295
294
"""
296
295
Compare for "less than" `other`.
297
296
@@ -307,7 +306,7 @@ def __lt__(self: Expression, other: Expression | Scalar) -> Expression:
307
306
Expression
308
307
"""
309
308
310
- def __and__ (self : Expression , other : Expression | bool ) -> Expression :
309
+ def __and__ (self , other : Expression | bool ) -> Expression :
311
310
"""
312
311
Apply logical 'and' to `other` expression (or scalar) and this expression.
313
312
@@ -328,7 +327,7 @@ def __and__(self: Expression, other: Expression | bool) -> Expression:
328
327
If `self` or `other` is not boolean.
329
328
"""
330
329
331
- def __or__ (self : Expression , other : Expression | bool ) -> Expression :
330
+ def __or__ (self , other : Expression | bool ) -> Expression :
332
331
"""
333
332
Apply logical 'or' to `other` expression (or scalar) and this expression.
334
333
@@ -349,7 +348,7 @@ def __or__(self: Expression, other: Expression | bool) -> Expression:
349
348
If `self` or `other` is not boolean.
350
349
"""
351
350
352
- def __add__ (self : Expression , other : Expression | Scalar ) -> Expression :
351
+ def __add__ (self , other : Expression | Scalar ) -> Expression :
353
352
"""
354
353
Add `other` expression or scalar to this expression.
355
354
@@ -365,7 +364,7 @@ def __add__(self: Expression, other: Expression | Scalar) -> Expression:
365
364
Expression
366
365
"""
367
366
368
- def __sub__ (self : Expression , other : Expression | Scalar ) -> Expression :
367
+ def __sub__ (self , other : Expression | Scalar ) -> Expression :
369
368
"""
370
369
Subtract `other` expression or scalar from this expression.
371
370
@@ -481,7 +480,7 @@ def __divmod__(self, other: Expression | Scalar) -> tuple[Expression, Expression
481
480
tuple[Expression, Expression]
482
481
"""
483
482
484
- def __invert__ (self : Expression ) -> Expression :
483
+ def __invert__ (self ) -> Expression :
485
484
"""
486
485
Invert truthiness of (boolean) elements.
487
486
@@ -491,7 +490,7 @@ def __invert__(self: Expression) -> Expression:
491
490
If any of the expression's expressions is not boolean.
492
491
"""
493
492
494
- def any (self : Expression , * , skip_nulls : bool = True ) -> Expression :
493
+ def any (self , * , skip_nulls : bool = True ) -> Expression :
495
494
"""
496
495
Reduction returns a bool.
497
496
@@ -501,7 +500,7 @@ def any(self: Expression, *, skip_nulls: bool = True) -> Expression:
501
500
If expression is not boolean.
502
501
"""
503
502
504
- def all (self : Expression , * , skip_nulls : bool = True ) -> Expression :
503
+ def all (self , * , skip_nulls : bool = True ) -> Expression :
505
504
"""
506
505
Reduction returns a bool.
507
506
@@ -595,26 +594,26 @@ def var(self, *, correction: int | float = 1, skip_nulls: bool = True) -> Expres
595
594
Whether to skip null values.
596
595
"""
597
596
598
- def cumulative_max (self : Expression ) -> Expression :
597
+ def cumulative_max (self ) -> Expression :
599
598
"""
600
599
Reduction returns a expression. Any data type that supports comparisons
601
600
must be supported. The returned value has the same dtype as the expression.
602
601
"""
603
602
604
- def cumulative_min (self : Expression ) -> Expression :
603
+ def cumulative_min (self ) -> Expression :
605
604
"""
606
605
Reduction returns a expression. Any data type that supports comparisons
607
606
must be supported. The returned value has the same dtype as the expression.
608
607
"""
609
608
610
- def cumulative_sum (self : Expression ) -> Expression :
609
+ def cumulative_sum (self ) -> Expression :
611
610
"""
612
611
Reduction returns a expression. Must be supported for numerical and
613
612
datetime data types. The returned value has the same dtype as the
614
613
expression.
615
614
"""
616
615
617
- def cumulative_prod (self : Expression ) -> Expression :
616
+ def cumulative_prod (self ) -> Expression :
618
617
"""
619
618
Reduction returns a expression. Must be supported for numerical and
620
619
datetime data types. The returned value has the same dtype as the
@@ -659,7 +658,7 @@ def is_nan(self) -> Expression:
659
658
In particular, does not check for `np.timedelta64('NaT')`.
660
659
"""
661
660
662
- def is_in (self : Expression , values : Expression ) -> Expression :
661
+ def is_in (self , values : Expression | EagerColumn [ Any ] ) -> Expression :
663
662
"""
664
663
Indicate whether the value at each row matches any value in `values`.
665
664
@@ -698,7 +697,7 @@ def unique_indices(self, *, skip_nulls: bool = True) -> Expression:
698
697
"""
699
698
...
700
699
701
- def fill_nan (self : Expression , value : float | NullType , / ) -> Expression :
700
+ def fill_nan (self , value : float | NullType , / ) -> Expression :
702
701
"""
703
702
Fill floating point ``nan`` values with the given fill value.
704
703
@@ -712,7 +711,7 @@ def fill_nan(self: Expression, value: float | NullType, /) -> Expression:
712
711
"""
713
712
...
714
713
715
- def fill_null (self : Expression , value : Scalar , / ) -> Expression :
714
+ def fill_null (self , value : Scalar , / ) -> Expression :
716
715
"""
717
716
Fill null values with the given fill value.
718
717
0 commit comments