def test_interpolate_polynomial1(): testing_df = df.copy() result_df = df.copy() clean.fillByInterpolation(testing_df, 0, 'polynomial', 2) result_df['col1'].interpolate(method='polynomial', order=2, inplace=True) assert (((testing_df.fillna(0) == result_df.fillna(0)).all()).all()) == True
def test_interpolate_all1(): testing_df = df.copy() clean.fillByInterpolation(testing_df, 2, 'linear', 4) assert (((testing_df.fillna(0) == df.fillna(0)).all()).all()) == True
def test_interpolate_pchip1(): testing_df = df.copy() result_df = df.copy() clean.fillByInterpolation(testing_df, 0, 'PCHIP', 4) result_df['col1'].interpolate(method='pchip',inplace=True) assert (((testing_df.fillna(0) == result_df.fillna(0)).all()).all()) == True
def test_interpolate_linear1(): testing_df = df.copy() result_df = df.copy() clean.fillByInterpolation(testing_df, 1, 'linear', 6) result_df['col2'].interpolate(method='linear', inplace=True) assert (((testing_df.fillna(0) == result_df.fillna(0)).all()).all()) == True
def test_interpolate_spline1(): testing_df = df.copy() result_df = df.copy() clean.fillByInterpolation(testing_df, 1, 'spline', 1) result_df['col2'].interpolate(method='spline', order=1, inplace=True) assert (((testing_df.fillna(0) == result_df.fillna(0)).all()).all()) == True
def test_intrpolate_polynomial2(): testing_df = df.copy() with pytest.raises(Exception): clean.fillByInterpolation(testing_df, 4, 'polynomial', 2)