File tree Expand file tree Collapse file tree 3 files changed +8
-14
lines changed Expand file tree Collapse file tree 3 files changed +8
-14
lines changed Original file line number Diff line number Diff line change @@ -527,10 +527,14 @@ def null_count(self: Self) -> int:
527
527
return self ._native_series .isna ().sum () # type: ignore[no-any-return]
528
528
529
529
def is_first_distinct (self : Self ) -> Self :
530
- return self ._from_native_series (~ self ._native_series .duplicated (keep = "first" ))
530
+ res = ~ self ._native_series .duplicated (keep = "first" )
531
+ res = self ._rename (res , self .name )
532
+ return self ._from_native_series (res )
531
533
532
534
def is_last_distinct (self : Self ) -> Self :
533
- return self ._from_native_series (~ self ._native_series .duplicated (keep = "last" ))
535
+ res = ~ self ._native_series .duplicated (keep = "last" )
536
+ res = self ._rename (res , self .name )
537
+ return self ._from_native_series (res )
534
538
535
539
def is_sorted (self : Self , * , descending : bool = False ) -> bool :
536
540
if not isinstance (descending , bool ):
Original file line number Diff line number Diff line change 1
1
from typing import Any
2
2
3
- import pytest
4
-
5
3
import narwhals .stable .v1 as nw
6
4
from tests .utils import compare_dicts
7
5
11
9
}
12
10
13
11
14
- def test_is_first_distinct_expr (constructor : Any , request : Any ) -> None :
15
- if "modin" in str (constructor ):
16
- # TODO(unassigned): why is Modin failing here?
17
- request .applymarker (pytest .mark .xfail )
12
+ def test_is_first_distinct_expr (constructor : Any ) -> None :
18
13
df = nw .from_native (constructor (data ))
19
14
result = df .select (nw .all ().is_first_distinct ())
20
15
expected = {
Original file line number Diff line number Diff line change 1
1
from typing import Any
2
2
3
- import pytest
4
-
5
3
import narwhals .stable .v1 as nw
6
4
from tests .utils import compare_dicts
7
5
11
9
}
12
10
13
11
14
- def test_is_last_distinct_expr (constructor : Any , request : Any ) -> None :
15
- if "modin" in str (constructor ):
16
- # TODO(unassigned): why is Modin failing here?
17
- request .applymarker (pytest .mark .xfail )
12
+ def test_is_last_distinct_expr (constructor : Any ) -> None :
18
13
df = nw .from_native (constructor (data ))
19
14
result = df .select (nw .all ().is_last_distinct ())
20
15
expected = {
You can’t perform that action at this time.
0 commit comments