Skip to content

Commit

Permalink
test: Added test for Table.remove_rows_with_outliers to test multip…
Browse files Browse the repository at this point in the history
…le outliers in one column and outliers in two different columns (#309)

### Summary of Changes

test: Added test for `Table.remove_rows_with_outliers` to test multiple
outliers in one column and outliers in two different columns

See my
[Comment](#274 (comment))
in the referenced issue for further explanation as there is no bug with
the current method `Table.remove_rows_with_outliers`

### Additional Context

See #274

---------

Co-authored-by: megalinter-bot <129584137+megalinter-bot@users.noreply.github.com>
Co-authored-by: Severin Paul Höfer <84280965+zzril@users.noreply.github.com>
  • Loading branch information
3 people authored Jun 12, 2023
1 parent 1326f40 commit d75ae96
Showing 1 changed file with 180 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,178 @@
},
),
),
(
Table(
{
"col1": [
"A",
"B",
"A",
"outlier_col3",
"a",
"a",
"a",
"a",
"a",
"a",
"outlier_col2",
"a",
],
"col2": [1.0, 2.0, 3.0, 4.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1000.0, None],
"col3": [2, 3, 1, 1_000_000_000, 1, 1, 1, 1, 1, 1, 1, 1],
},
),
Table(
{
"col1": [
"A",
"B",
"A",
"a",
"a",
"a",
"a",
"a",
"a",
"a",
],
"col2": [1.0, 2.0, 3.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, None],
"col3": [2, 3, 1, 1, 1, 1, 1, 1, 1, 1],
},
),
),
(
Table(
{
"col1": [
"A",
"B",
"A",
"positive_outlier",
"a",
"a",
"a",
"a",
"a",
"a",
"a",
"a",
"negative_outlier",
"a",
"a",
"a",
"a",
"a",
"a",
"a",
"a",
"a",
"a",
],
"col2": [
1.0,
2.0,
3.0,
4.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
None,
1.0,
2.0,
1.0,
4.0,
1.0,
3.0,
1.0,
2.0,
1.0,
4.0,
1.0,
],
"col3": [
2,
3,
1,
1_000_000_000_000,
1,
1,
1,
1,
1,
1,
1,
1,
-1_000_000_000_000,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
],
},
),
Table(
{
"col1": [
"A",
"B",
"A",
"a",
"a",
"a",
"a",
"a",
"a",
"a",
"a",
"a",
"a",
"a",
"a",
"a",
"a",
"a",
"a",
"a",
"a",
],
"col2": [
1.0,
2.0,
3.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
None,
2.0,
1.0,
4.0,
1.0,
3.0,
1.0,
2.0,
1.0,
4.0,
1.0,
],
"col3": [2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
},
),
),
(
Table(
{
Expand All @@ -78,7 +250,14 @@
),
(Table(), Table()),
],
ids=["no outliers", "with outliers", "no rows", "empty"],
ids=[
"no outliers",
"one outlier",
"outliers in two different columns",
"multiple outliers in one column",
"no rows",
"empty",
],
)
def test_should_remove_rows_with_outliers(table: Table, expected: Table) -> None:
updated_table = table.remove_rows_with_outliers()
Expand Down

0 comments on commit d75ae96

Please sign in to comment.