Skip to content

Commit

Permalink
feat: rename remove_outliers to drop_rows_with_outliers (#95)
Browse files Browse the repository at this point in the history
Closes #93.

### Summary of Changes

Rename `remove_outliers` to `drop_rows_with_outliers` in `Table`.
  • Loading branch information
lars-reimann authored Mar 27, 2023
1 parent b960214 commit 7bad2e3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
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

0 comments on commit 7bad2e3

Please sign in to comment.