Ejemplo n.º 1
0
def test_cross_treshold_empty():
    y = pd.Series(data=[np.nan, 1, 3, 1], index=[2002, 2005, 2007, 2013])
    obs = cross_threshold(y, 4)
    assert obs == []
Ejemplo n.º 2
0
def test_cross_treshold_from_above():
    y = pd.Series(data=[np.nan, 1, 3, 1], index=[2002, 2005, 2007, 2013])
    obs = cross_threshold(y, 2, direction="from above")
    assert obs == [2011]
Ejemplo n.º 3
0
def test_cross_treshold_from_below():
    y = pd.Series(data=[np.nan, 1, 3, 1], index=[2002, 2005, 2007, 2013])
    obs = cross_threshold(y, 2, direction='from below')
    assert obs == [2007]