Beispiel #1
0
    def test__normalize(self):
        """Test normalize data"""
        # Setup
        data = pd.Series([-0.43, 0.1234, 1.5, -1.31])

        # Run
        result = CategoricalTransformer._normalize(data)

        # Asserts
        expect = pd.Series([0.43, 0.1234, 0.5, 0.31], dtype=float)

        pd.testing.assert_series_equal(result, expect)
Beispiel #2
0
    def test__normalize_no_clip(self):
        """Test normalize data"""
        # Setup
        transformer = CategoricalTransformer(clip=False)

        # Run
        data = pd.Series([-0.43, 0.1234, 1.5, -1.31])
        result = transformer._normalize(data)

        # Asserts
        expect = pd.Series([0.57, 0.1234, 0.5, 0.69], dtype=float)

        pd.testing.assert_series_equal(result, expect)