Commit 669ad687 authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

TEST: test removeIfSparse ignoreType argument

parent 2e4da347
......@@ -12,6 +12,7 @@ import numpy as np
import pandas as pd
import funpack.importing as importing
import funpack.util as util
import funpack.processing_functions as pfns
from . import (gen_DataTable,
......@@ -37,6 +38,37 @@ def test_removeIfSparse():
assert remove == []
def test_removeIfSparse_typed():
mincat = np.zeros(100)
good = np.zeros(100)
maxcat = np.zeros(100)
mincat[:5] = 1
maxcat[:95] = 1
good[ :50] = 1
dtable = gen_DataTable([mincat, good, maxcat])
dtable.vartable.loc[1, 'Type'] = util.CTYPES.categorical_single
dtable.vartable.loc[2, 'Type'] = util.CTYPES.categorical_single
dtable.vartable.loc[3, 'Type'] = util.CTYPES.categorical_single
remove = pfns.removeIfSparse(dtable, [1, 2, 3], mincat=10, maxcat=90)
remove = [r.name for r in remove]
assert remove == ['1-0.0', '3-0.0']
dtable.vartable.loc[1, 'Type'] = util.CTYPES.unknown
dtable.vartable.loc[2, 'Type'] = util.CTYPES.unknown
dtable.vartable.loc[3, 'Type'] = util.CTYPES.unknown
remove = pfns.removeIfSparse(dtable, [1, 2, 3], mincat=10, maxcat=90)
remove = [r.name for r in remove]
assert remove == []
remove = pfns.removeIfSparse(dtable, [1, 2, 3], mincat=10, maxcat=90,
ignoreType=True)
remove = [r.name for r in remove]
assert remove == ['1-0.0', '3-0.0']
def test_removeIfRedundant():
series1 = np.sin(np.linspace(0, np.pi * 6, 100))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment