diff --git a/src/safeds/data/tabular/containers/_table.py b/src/safeds/data/tabular/containers/_table.py index fc32f9cc7..d53f314af 100644 --- a/src/safeds/data/tabular/containers/_table.py +++ b/src/safeds/data/tabular/containers/_table.py @@ -1007,7 +1007,7 @@ def transform_column( # ------------------------------------------------------------------------------------------------------------------ @overload - def count_row_if( + def count_rows_if( self, predicate: Callable[[Row], Cell[bool | None]], *, @@ -1015,14 +1015,14 @@ def count_row_if( ) -> int: ... @overload - def count_row_if( + def count_rows_if( self, predicate: Callable[[Row], Cell[bool | None]], *, ignore_unknown: bool, ) -> int | None: ... - def count_row_if( + def count_rows_if( self, predicate: Callable[[Row], Cell[bool | None]], *, @@ -1059,10 +1059,10 @@ def count_row_if( -------- >>> from safeds.data.tabular.containers import Table >>> table = Table({"col1": [1, 2, 3], "col2": [1, 3, 3]}) - >>> table.count_row_if(lambda row: row["col1"] == row["col2"]) + >>> table.count_rows_if(lambda row: row["col1"] == row["col2"]) 2 - >>> table.count_row_if(lambda row: row["col1"] > row["col2"]) + >>> table.count_rows_if(lambda row: row["col1"] > row["col2"]) 0 """ expression = predicate(_LazyVectorizedRow(self))._polars_expression diff --git a/tests/safeds/data/tabular/containers/_table/test_count_row_if.py b/tests/safeds/data/tabular/containers/_table/test_count_rows_if.py similarity index 88% rename from tests/safeds/data/tabular/containers/_table/test_count_row_if.py rename to tests/safeds/data/tabular/containers/_table/test_count_rows_if.py index b4ab7f289..638675d49 100644 --- a/tests/safeds/data/tabular/containers/_table/test_count_row_if.py +++ b/tests/safeds/data/tabular/containers/_table/test_count_rows_if.py @@ -1,4 +1,5 @@ import pytest + from safeds.data.tabular.containers import Table @@ -30,7 +31,7 @@ def test_should_handle_boolean_logic( expected: int, ) -> None: table = Table({"a": values}) - assert table.count_row_if(lambda row: row["a"] < 2) == expected + assert table.count_rows_if(lambda row: row["a"] < 2) == expected @pytest.mark.parametrize( @@ -61,4 +62,4 @@ def test_should_handle_kleene_logic( expected: int | None, ) -> None: table = Table({"a": values}) - assert table.count_row_if(lambda row: row["a"] < 2, ignore_unknown=False) == expected + assert table.count_rows_if(lambda row: row["a"] < 2, ignore_unknown=False) == expected