Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/safeds/data/tabular/containers/_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
-------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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={
Expand All @@ -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={
Expand All @@ -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