Ejemplo n.º 1
0
def test_Calculate_NA_has_NaN_ratio(City):
    City["bf"] = 999
    City["bf2"] = 2
    z = City.columns
    values_to_nan(City, inplace=True, values=[2, 999])
    c = calculate_NaN_ratio(City, inplace=True, axis=0).columns
    assert c.shape == (17, )
Ejemplo n.º 2
0
def test_calculate_NaN_ratio(City):
    City["bf"] = 999
    City["bf2"] = 2
    z = City.columns
    values_to_nan(City, inplace=True, values=[2, 999])
    c = calculate_NaN_ratio(City, inplace=True, axis=0).columns
    assert len(c) == len(z) + 1
Ejemplo n.º 3
0
def test_delete_NA_Features_to1_threshold(City):
    City["bf"] = 999
    City["bf2"] = 2
    z = City.shape[1] - 0
    values_to_nan(City, inplace=True, values=[-1])
    assert delete_NA_Features(City, inplace=True,
                              threshold=1.0).shape[1] == z + 1
Ejemplo n.º 4
0
def test_delete_NA_Features_to_2(City):
    City["bf"] = 999
    City["bf2"] = 2
    z = City.shape[1] - 1
    values_to_nan(City, inplace=True, values=[2])
    assert delete_NA_Features(City, inplace=True, threshold=0.8,
                              axis=1).shape[1] == z
Ejemplo n.º 5
0
def test_calculate_NaN_ratio_err(City):
    City["bf"] = 999
    City["bf2"] = 2
    z = City.columns
    values_to_nan(City, inplace=True, values=[2, 999])
    c = calculate_NaN_ratio(City, inplace=True, axis=1).columns
    with pytest.raises(AssertionError):
        assert len(c) == len(z) + 1
Ejemplo n.º 6
0
def test_delete_NA_Features_to_big_threshold(City):
    City["bf"] = 999
    City["bf2"] = 2
    z = City.shape[1] - 0
    values_to_nan(City, inplace=True, values=[2])
    with pytest.raises(PasoError):
        assert (delete_NA_Features(City, inplace=True, axis=2,
                                   threshold=1.1).shape[1] == z + 1)
Ejemplo n.º 7
0
def test_Values_to_nan_0_0(City):
    assert values_to_nan(City, inplace=True,
                         values=0.0).isnull().sum().sum() == 843
Ejemplo n.º 8
0
def test_Values_to_nan_none(City):
    assert values_to_nan(City, inplace=True,
                         values=[]).isnull().sum().sum() == 0
Ejemplo n.º 9
0
def test_Calculate_NA_has_NaN_ratio_c_err(City):
    City["bf"] = 999
    City["bf2"] = 2
    values_to_nan(City, inplace=True, values=[2, 999])
    calculate_NaN_ratio(City, inplace=True, axis=1).count().count() == 512 * 16
Ejemplo n.º 10
0
def test_Calculate_NA_has_NaN_ratio_count(City):
    City["bf"] = 999
    City["bf2"] = 2
    values_to_nan(City, inplace=True, values=[2, 999])
    assert calculate_NaN_ratio(City, inplace=True,
                               axis=0).count().count() == 17