Beispiel #1
0
    def test_reverse_transform_no_nulls(self):
        """Test reverse_transform with no nulls"""
        # Setup
        data = pd.Series([1.5, None, 2.5])

        # Run
        transformer = Mock()
        transformer.nulls = False

        result = NullTransformer.reverse_transform(transformer, data)

        # Asserts
        expect = pd.Series([1.5, None, 2.5])

        np.testing.assert_array_equal(result, expect,
                                      "Unextected reverse data")
Beispiel #2
0
    def test_reverse_transform_nulls_and_null_column(self):
        """Test reverse_transform with nulls and null_column"""
        # Setup
        data = np.array([[1.5, 0], [0.6, 1], [2.5, 0]])

        # Run
        transformer = Mock()
        transformer.nulls = True
        transformer._null_column = True

        result = NullTransformer.reverse_transform(transformer, data)

        # Asserts
        expect = pd.Series([1.5, np.nan, 2.5])

        np.testing.assert_array_equal(result, expect,
                                      "Unextected reverse data")