Commit a6d5b4f3 authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

TEST: Test isSparse on non-numeric data

parent d70d6d8f
......@@ -193,6 +193,24 @@ def test_isSparse_mincat():
assert resultprop == expected
def test_isSparse_non_numeric():
data = list(np.random.randint(1, 10, 100))
data[50] = 'abcde'
data[51] = np.nan
data = pd.Series(data)
assert core.isSparse(data, minstd=10) == (False, None, None)
data = pd.Series(['a', 'a', 'b', 'b', 'b', np.nan, np.nan])
assert core.isSparse(data, mincat=1) == (False, None, None)
assert core.isSparse(data, mincat=2) == (False, None, None)
assert core.isSparse(data, mincat=3) == (True, 'mincat', 2)
assert core.isSparse(data, maxcat=4) == (False, None, None)
assert core.isSparse(data, maxcat=3) == (True, 'maxcat', 3)
def test_redundantColumns():
size = 50
......
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