Exemple #1
0
def test_squish_infinite():
    a = [-np.inf, np.inf, -np.inf, np.inf]
    npt.assert_allclose(squish_infinite(a), [0, 1, 0, 1])
    npt.assert_allclose(squish_infinite(a, (-100, 100)),
                        [-100, 100, -100, 100])

    b = np.array([5, -np.inf, 2, 3, 6])
    npt.assert_allclose(squish_infinite(b, (1, 10)), [5, 1, 2, 3, 6])
Exemple #2
0
def test_squish_infinite():
    a = [-np.inf, np.inf, -np.inf, np.inf]
    npt.assert_allclose(squish_infinite(a), [0, 1, 0, 1])
    npt.assert_allclose(squish_infinite(a, (-100, 100)),
                        [-100, 100, -100, 100])

    b = np.array([5, -np.inf, 2, 3, 6])
    npt.assert_allclose(squish_infinite(b, (1, 10)),
                        [5, 1, 2, 3, 6])

    # Maintains the same index
    s = pd.Series([1, 2, 3, 4], index=[4, 3, 2, 1])
    result = squish_infinite(s)
    assert s.index.equals(result.index)
def test_squish_infinite():
    a = [-np.inf, np.inf, -np.inf, np.inf]
    npt.assert_allclose(squish_infinite(a), [0, 1, 0, 1])
    npt.assert_allclose(squish_infinite(a, (-100, 100)),
                        [-100, 100, -100, 100])

    b = np.array([5, -np.inf, 2, 3, 6])
    npt.assert_allclose(squish_infinite(b, (1, 10)),
                        [5, 1, 2, 3, 6])

    # Maintains the same index
    s = pd.Series([1, 2, 3, 4], index=[4, 3, 2, 1])
    result = squish_infinite(s)
    assert s.index.equals(result.index)
 def squish_infinite_y(data):
     return squish_infinite(data, range=panel_params['y_range'])
 def squish_infinite_y(data):
     return squish_infinite(data, range=panel_params.y.range)