Skip to content

Commit

Permalink
Merge pull request #173 from lvgig/feature/null_indicator_int8
Browse files Browse the repository at this point in the history
updated NullIndicator to convert to int8, fixed tests
  • Loading branch information
davidhopkinson26 authored Feb 5, 2024
2 parents e5ce428 + ac36986 commit fb205d2
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ Subsections for each version can be one of the following;

Each individual change should have a link to the pull request after the description of the change.

1.1.2 (2024-02-07)
------------------

Added
^^^^^
- Updated NullIndicator to return int8 columns `#173 https://github.com/lvgig/tubular/pull/173`_

1.1.1 (2024-01-18)
------------------

Expand Down
6 changes: 5 additions & 1 deletion tests/imputers/test_NullIndicator.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,14 @@ def test_super_transform_called(self, mocker):
)
def test_null_indicator_columns_correct(self, df, expected):
"""Test that the created indicator column is correct - and unrelated columns are unchanged."""
x = NullIndicator(columns=["b", "c"])
columns = ["b", "c"]
x = NullIndicator(columns=columns)

df_transformed = x.transform(df)

for col in [column + "_nulls" for column in columns]:
expected[col] = expected[col].astype(np.int8)

ta.equality.assert_equal_dispatch(
expected=expected,
actual=df_transformed,
Expand Down
2 changes: 1 addition & 1 deletion tubular/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.1.1"
__version__ = "1.1.2"
2 changes: 1 addition & 1 deletion tubular/imputers.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,6 @@ def transform(self, X: pd.DataFrame) -> pd.DataFrame:
X = super().transform(X)

for c in self.columns:
X[f"{c}_nulls"] = X[c].isna().astype(int)
X[f"{c}_nulls"] = X[c].isna().astype(np.int8)

return X

0 comments on commit fb205d2

Please sign in to comment.