コード例 #1
0
def test_fillna_numerical():
    df_test = InsolverDataFrame(pd.DataFrame(data={'col1': [1, 2, np.nan]}))
    df_transformed = InsolverTransform(df_test, [
        AutoFillNATransforms(),
    ])
    df_transformed.ins_transform()
    assert df_transformed['col1'][2] == 1.5
コード例 #2
0
def test_fillna_categorical():
    df_test = InsolverDataFrame(
        pd.DataFrame(data={'col1': ['A', 'B', 'C', 'A', None]}))
    df_transformed = InsolverTransform(df_test, [
        AutoFillNATransforms(),
    ])
    df_transformed.ins_transform()
    assert df_transformed['col1'][4] == 'A'
コード例 #3
0
def test_fillna_categorical_all_na():
    df_test = InsolverDataFrame(
        pd.DataFrame(data={'col1': [None, None, None]}))
    df_transformed = InsolverTransform(df_test, [
        AutoFillNATransforms(),
    ])
    df_transformed.ins_transform()
    assert df_transformed['col1'][0] == 1
    assert df_transformed['col1'][1] == 1
    assert df_transformed['col1'][2] == 1
コード例 #4
0
def test_EncoderTransforms():
    df_test = InsolverDataFrame(
        pd.DataFrame(data={'col1': ['A', 'B', 'C', 'A']}))
    df_transformed = InsolverTransform(df_test, [
        EncoderTransforms(['col1']),
    ])
    df_transformed.ins_transform()
    assert df_transformed['col1'][0] == 0
    assert df_transformed['col1'][1] == 1
    assert df_transformed['col1'][2] == 2
    assert df_transformed['col1'][3] == 0
コード例 #5
0
def test_OneHotEncoderTransforms():
    df_test = InsolverDataFrame(
        pd.DataFrame(data={'col1': ['A', 'B', 'C', 'A']}))
    df_transformed = InsolverTransform(df_test, [
        OneHotEncoderTransforms(['col1']),
    ])
    df_transformed.ins_transform()
    assert 'col1_A' in df_transformed.columns
    assert 'col1_B' in df_transformed.columns
    assert 'col1_C' in df_transformed.columns
    assert df_transformed['col1_A'][0] == 1
    assert df_transformed['col1_B'][1] == 1
    assert df_transformed['col1_C'][2] == 1
    assert df_transformed['col1_A'][3] == 1
コード例 #6
0
 def get_claims(self):
     if self._df_claims_result:
         return InsolverDataFrame(self._df_claims_result)
     else:
         return None
コード例 #7
0
 def get_policies(self):
     if self._df_policies_result:
         return InsolverDataFrame(self._df_policies_result)
     else:
         return None