|
|
|
@ -28,7 +28,7 @@ def test_selection_select(example):
@@ -28,7 +28,7 @@ def test_selection_select(example):
|
|
|
|
|
assert list(result["value"]) == [35, 9] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_selection_split_one_column(example): |
|
|
|
|
def test_selection_split_one_column_without_na(example): |
|
|
|
|
from sensospot_tools.selection import split |
|
|
|
|
|
|
|
|
|
result = dict(split(example, "carnivore")) |
|
|
|
@ -38,6 +38,20 @@ def test_selection_split_one_column(example):
@@ -38,6 +38,20 @@ def test_selection_split_one_column(example):
|
|
|
|
|
assert list(result[False]["value"]) == [35, 9] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_selection_split_one_column_with_na(example): |
|
|
|
|
import numpy |
|
|
|
|
from sensospot_tools.selection import split |
|
|
|
|
|
|
|
|
|
example["carnivore"].iloc[1] = numpy.nan |
|
|
|
|
|
|
|
|
|
result = dict(split(example, "carnivore")) |
|
|
|
|
|
|
|
|
|
assert set(result.keys()) == {False, True, numpy.nan} |
|
|
|
|
assert list(result[True]["value"]) == [3, 60] |
|
|
|
|
assert list(result[False]["value"]) == [35, 9] |
|
|
|
|
assert list(result[numpy.nan]["value"]) == [55] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_selection_split_multiple_columns(example): |
|
|
|
|
from sensospot_tools.selection import split |
|
|
|
|
|
|
|
|
|