From 7bad2e3e1b11fe45ed1fc408fa6289dfb5f301cb Mon Sep 17 00:00:00 2001 From: Lars Reimann Date: Mon, 27 Mar 2023 15:45:07 +0200 Subject: [PATCH] feat: rename `remove_outliers` to `drop_rows_with_outliers` (#95) Closes #93. ### Summary of Changes Rename `remove_outliers` to `drop_rows_with_outliers` in `Table`. --- src/safeds/data/tabular/containers/_table.py | 6 +++--- ...e_outliers.py => test_drop_rows_with_outliers.py} | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) rename tests/safeds/data/tabular/containers/_table/{test_remove_outliers.py => test_drop_rows_with_outliers.py} (82%) diff --git a/src/safeds/data/tabular/containers/_table.py b/src/safeds/data/tabular/containers/_table.py index 34bcbaa2b..1eed44683 100644 --- a/src/safeds/data/tabular/containers/_table.py +++ b/src/safeds/data/tabular/containers/_table.py @@ -759,10 +759,10 @@ def sort_columns( columns.sort(key=functools.cmp_to_key(query)) return Table.from_columns(columns) - def remove_outliers(self) -> Table: + def drop_rows_with_outliers(self) -> Table: """ - Remove all rows from the table that contain at least one outlier defined as having a value that has a distance of - more than 3 standard deviations from the column average. + Remove all rows from the table that contain at least one outlier defined as having a value that has a distance + of more than 3 standard deviations from the column average. Returns ------- diff --git a/tests/safeds/data/tabular/containers/_table/test_remove_outliers.py b/tests/safeds/data/tabular/containers/_table/test_drop_rows_with_outliers.py similarity index 82% rename from tests/safeds/data/tabular/containers/_table/test_remove_outliers.py rename to tests/safeds/data/tabular/containers/_table/test_drop_rows_with_outliers.py index 6eafc85fa..25b12a458 100644 --- a/tests/safeds/data/tabular/containers/_table/test_remove_outliers.py +++ b/tests/safeds/data/tabular/containers/_table/test_drop_rows_with_outliers.py @@ -4,7 +4,7 @@ from safeds.data.tabular.typing import ColumnType, TableSchema -def test_remove_outliers_no_outliers() -> None: +def test_drop_rows_with_outliers_no_outliers() -> None: table = Table( pd.DataFrame( data={ @@ -15,13 +15,13 @@ def test_remove_outliers_no_outliers() -> None: ) ) names = table.get_column_names() - result = table.remove_outliers() + result = table.drop_rows_with_outliers() assert result.count_rows() == 3 assert result.count_columns() == 3 assert names == table.get_column_names() -def test_remove_outliers_with_outliers() -> None: +def test_drop_rows_with_outliers_with_outliers() -> None: table = Table( pd.DataFrame( data={ @@ -44,15 +44,15 @@ def test_remove_outliers_with_outliers() -> None: } ) ) - result = table.remove_outliers() + result = table.drop_rows_with_outliers() assert result.count_rows() == 11 assert result.count_columns() == 3 -def test_remove_outliers_no_rows() -> None: +def test_drop_rows_with_outliers_no_rows() -> None: table = Table( [], TableSchema({"col1": ColumnType.from_numpy_dtype(np.dtype(float))}) ) - result = table.remove_outliers() + result = table.drop_rows_with_outliers() assert result.count_rows() == 0 assert result.count_columns() == 1