diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 936f502..63c4b1b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -31,10 +31,12 @@ repos: - id: trailing-whitespace - id: end-of-file-fixer - id: check-yaml + - id: check-xml - id: mixed-line-ending args: ["--fix=lf"] - id: check-added-large-files - id: check-ast + - id: check-builtin-literals - id: check-case-conflict - id: check-docstring-first - id: check-merge-conflict @@ -42,21 +44,53 @@ repos: - id: debug-statements - id: fix-byte-order-marker - id: forbid-new-submodules + - id: forbid-submodules + - id: detect-private-key + - id: no-commit-to-branch + args: ["--branch=main", "--branch=develop"] - - repo: https://github.com/asottile/pyupgrade - rev: v3.3.1 + - repo: https://github.com/pre-commit/pygrep-hooks + rev: v1.10.0 hooks: - - id: pyupgrade + - id: python-use-type-annotations + - id: python-check-blanket-noqa + - id: python-check-mock-methods + - id: python-no-eval + - id: python-no-log-warn + - id: python-use-type-annotations + - id: text-unicode-replacement-char + + - repo: https://github.com/PyCQA/docformatter + rev: v1.5.1 + hooks: + - id: docformatter + + - repo: https://github.com/nbQA-dev/nbQA + rev: 1.6.1 + hooks: + - id: nbqa-check-ast + - id: nbqa-mypy + args: ["--config-file=pyproject.toml"] + - id: nbqa-pyupgrade - repo: https://github.com/bwhmather/ssort rev: v0.11.6 hooks: - id: ssort + - repo: https://github.com/asottile/pyupgrade + rev: v3.3.1 + hooks: + - id: pyupgrade + - repo: https://github.com/psf/black rev: 22.12.0 hooks: - id: black + args: ["--config=pyproject.toml"] + - id: black-jupyter + args: ["--config=pyproject.toml"] + files: \.ipynb$ - repo: https://github.com/PyCQA/isort rev: 5.11.4 @@ -65,7 +99,7 @@ repos: args: ["--profile=black"] - repo: https://github.com/PyCQA/pylint - rev: v2.15.9 + rev: v2.15.10 hooks: - id: pylint args: ["--rcfile=pyproject.toml"] @@ -86,6 +120,11 @@ repos: args: - "-r" + - repo: https://github.com/kynan/nbstripout + rev: 0.6.1 + hooks: + - id: nbstripout + - repo: https://github.com/python-poetry/poetry rev: 1.3.0 hooks: diff --git a/src/sk_transformers/base_transformer.py b/src/sk_transformers/base_transformer.py index cc07c59..8c3291b 100644 --- a/src/sk_transformers/base_transformer.py +++ b/src/sk_transformers/base_transformer.py @@ -4,11 +4,14 @@ class BaseTransformer(BaseEstimator, TransformerMixin): - """ - Base class for all custom transformers. This class inherits from BaseEstimator and TransformerMixin. - Its main purpose is to provide an implementation of the `fit` method that does nothing except setting the `self.fitted_` to `True`. - Since most custom transformers do not need to implement a fit method, this class - can be used as a base class for all transformers not needing a `fit` method. + """Base class for all custom transformers. + + This class inherits from BaseEstimator and TransformerMixin. Its + main purpose is to provide an implementation of the `fit` method + that does nothing except setting the `self.fitted_` to `True`. Since + most custom transformers do not need to implement a fit method, this + class can be used as a base class for all transformers not needing a + `fit` method. """ def __init__(self) -> None: diff --git a/src/sk_transformers/datetime_transformer.py b/src/sk_transformers/datetime_transformer.py index e09d050..a2af5d3 100644 --- a/src/sk_transformers/datetime_transformer.py +++ b/src/sk_transformers/datetime_transformer.py @@ -8,8 +8,7 @@ class DurationCalculatorTransformer(BaseTransformer): - """ - Calculates the duration between to given dates. + """Calculates the duration between to given dates. Example: ```python @@ -50,8 +49,7 @@ def __init__( self.new_column_name = new_column_name def transform(self, X: pd.DataFrame) -> pd.DataFrame: - """ - Transform method that calculates the duration between two dates. + """Transform method that calculates the duration between two dates. Args: X (pandas.DataFrame): The input DataFrame. @@ -75,8 +73,8 @@ def transform(self, X: pd.DataFrame) -> pd.DataFrame: class TimestampTransformer(BaseTransformer): - """ - Transforms a date column with a specified format into a timestamp column. + """Transforms a date column with a specified format into a timestamp + column. Example: ```python @@ -109,8 +107,7 @@ def __init__( self.date_format = date_format def transform(self, X: pd.DataFrame) -> pd.DataFrame: - """ - Transforms columns from the provided dataframe. + """Transforms columns from the provided dataframe. Args: X (pandas.DataFrame): Dataframe with columns to transform. diff --git a/src/sk_transformers/deep_transformer.py b/src/sk_transformers/deep_transformer.py index c0904a1..b2ef113 100644 --- a/src/sk_transformers/deep_transformer.py +++ b/src/sk_transformers/deep_transformer.py @@ -12,9 +12,12 @@ class ToVecTransformer(BaseEstimator, TransformerMixin): - """ - This transformer trains an [FT-Transformer](https://paperswithcode.com/method/ft-transformer) - using the [pytorch-widedeep package](https://github.com/jrzaurin/pytorch-widedeep) and extracts the embeddings + """This transformer trains an [FT- + Transformer](https://paperswithcode.com/method/ft-transformer) using the. + + [pytorch-widedeep package](https://github.com/jrzaurin/pytorch-widedeep) + and extracts the embeddings. + from its embedding layer. The output shape of the transformer is (number of rows,(`input_dim` * number of columns)). Please refer to [this example](https://pytorch-widedeep.readthedocs.io/en/latest/examples/09_extracting_embeddings.html) for pytorch_widedeep example on how to extract embeddings. @@ -99,8 +102,8 @@ def __init__( self.tab_vec_: Optional[Tab2Vec] = None def fit(self, X: pd.DataFrame, y: NDArray) -> "ToVecTransformer": - """ - Fits the `ToVecTransformer`. The `TabPreprocessor` is fitted and the `FTTransformer` is trained. + """Fits the `ToVecTransformer`. The `TabPreprocessor` is fitted and the + `FTTransformer` is trained. Args: X (pd.DataFrame): The input data. @@ -151,8 +154,8 @@ def fit(self, X: pd.DataFrame, y: NDArray) -> "ToVecTransformer": return self def transform(self, X: pd.DataFrame) -> pd.DataFrame: - """ - Transforms the input data and returns the embeddings. + """Transforms the input data and returns the embeddings. + The output shape is (number of rows,(`input_dim` * number of columns)). Args: diff --git a/src/sk_transformers/encoder_transformer.py b/src/sk_transformers/encoder_transformer.py index 651996a..c9b2486 100644 --- a/src/sk_transformers/encoder_transformer.py +++ b/src/sk_transformers/encoder_transformer.py @@ -6,8 +6,8 @@ class MeanEncoderTransformer(BaseEstimator, TransformerMixin): - """ - Scikit-learn API for the [feature-engine MeanEncoder](https://feature-engine.readthedocs.io/en/latest/api_doc/encoding/MeanEncoder.html). + """Scikit-learn API for the [feature-engine MeanEncoder](https://feature- + engine.readthedocs.io/en/latest/api_doc/encoding/MeanEncoder.html). Example: ```python @@ -44,8 +44,7 @@ def __init__(self, fill_na_value: Union[int, float] = -999) -> None: self.fill_na_value = fill_na_value def fit(self, X: pd.DataFrame, y: pd.Series) -> "MeanEncoderTransformer": - """ - Fit the MeanEncoder to the data. + """Fit the MeanEncoder to the data. Args: X (pandas.DataFrame): DataFrame to fit the MeanEncoder to. @@ -58,8 +57,7 @@ def fit(self, X: pd.DataFrame, y: pd.Series) -> "MeanEncoderTransformer": return self def transform(self, X: pd.DataFrame) -> pd.DataFrame: - """ - Transform the data using the fitted MeanEncoder. + """Transform the data using the fitted MeanEncoder. Args: X (pandas.DataFrame): DataFrame to transform. diff --git a/src/sk_transformers/generic_transformer.py b/src/sk_transformers/generic_transformer.py index e92fba6..29f2cdf 100644 --- a/src/sk_transformers/generic_transformer.py +++ b/src/sk_transformers/generic_transformer.py @@ -10,8 +10,7 @@ class DtypeTransformer(BaseTransformer): - """ - Transformer that converts a column to a different dtype. + """Transformer that converts a column to a different dtype. Example: ```python @@ -38,8 +37,8 @@ def __init__(self, features: List[Tuple[str, Union[str, type]]]) -> None: self.features = features def transform(self, X: pd.DataFrame) -> pd.DataFrame: - """ - Transform the dataframe by converting the columns to the specified dtypes. + """Transform the dataframe by converting the columns to the specified + dtypes. Args: X (pandas.DataFrame): dataframe to transform. @@ -55,10 +54,12 @@ def transform(self, X: pd.DataFrame) -> pd.DataFrame: class AggregateTransformer(BaseTransformer): - """ - This transformer uses Pandas `groupby` method and `aggregate` to apply function on a column grouped by another column. - Read more about Pandas [`aggregate`](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.aggregate.html) method - to understand how to use function for aggregation. Other than Pandas function this transformer only support functions and string-names. + """This transformer uses Pandas `groupby` method and `aggregate` to apply + function on a column grouped by another column. Read more about Pandas [`ag + gregate`](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.agg + regate.html) method to understand how to use function for aggregation. + Other than Pandas function this transformer only support functions and + string-names. Example: ```python @@ -101,8 +102,8 @@ def __init__(self, features: List[Tuple[str, str, List[str]]]) -> None: self.features = features def transform(self, X: pd.DataFrame) -> pd.DataFrame: - """ - Creates new columns by using Pandas `groupby` method and `aggregate` to apply function on the column. + """Creates new columns by using Pandas `groupby` method and `aggregate` + to apply function on the column. Args: X (pd.DataFrame): Input dataframe. @@ -142,10 +143,14 @@ def transform(self, X: pd.DataFrame) -> pd.DataFrame: class FunctionsTransformer(BaseTransformer): - """ - This transformer is a plain wrapper around the [`sklearn.preprocessing.FunctionTransformer`](https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.FunctionTransformer.html). - Its main function is to apply multiple functions to different columns. Other than the scikit-learn transformer, - this transformer *does not* support the `inverse_func`, `accept_sparse`, `feature_names_out` and, `inv_kw_args` parameters. + """This transformer is a plain wrapper around the. + + [`sklearn.preprocessing.FunctionTransformer`](https://scikit-learn.org/stab + le/modules/generated/sklearn.preprocessing.FunctionTransformer.html). Its + main function is to apply multiple functions to different columns. Other + than the scikit-learn transformer, this transformer *does not* support the + `inverse_func`, `accept_sparse`, `feature_names_out` and, `inv_kw_args` + parameters. Example: ```python @@ -177,8 +182,8 @@ def __init__( self.features = features def transform(self, X: pd.DataFrame) -> pd.DataFrame: - """ - Applies the functions to the columns, and returns the dataframe with the modified columns. + """Applies the functions to the columns, and returns the dataframe with + the modified columns. Args: X (pandas.DataFrame): DataFrame containing the columns to apply the functions on. @@ -198,9 +203,10 @@ def transform(self, X: pd.DataFrame) -> pd.DataFrame: class MapTransformer(BaseTransformer): - """ - This transformer iterates over all columns in the `features` list and applies the given callback to the column. - For this it uses the [`pandas.Series.map`](https://pandas.pydata.org/docs/reference/api/pandas.Series.map.html) method. + """This transformer iterates over all columns in the `features` list and + applies the given callback to the column. For this it uses the [`pandas.Ser + ies.map`](https://pandas.pydata.org/docs/reference/api/pandas.Series.map.ht + ml) method. Example: ```python @@ -228,8 +234,7 @@ def __init__(self, features: List[Tuple[str, Callable]]) -> None: self.features = features def transform(self, X: pd.DataFrame) -> pd.DataFrame: - """ - Applies the callback to the column. + """Applies the callback to the column. Args: X (pandas.DataFrame): Dataframe containing the the columns to apply the callback on. @@ -248,8 +253,7 @@ def transform(self, X: pd.DataFrame) -> pd.DataFrame: class ColumnDropperTransformer(BaseTransformer): - """ - Drops columns from a dataframe using Pandas `drop` method. + """Drops columns from a dataframe using Pandas `drop` method. Example: ```python @@ -276,8 +280,7 @@ def __init__(self, columns: Union[str, List[str]]) -> None: self.columns = columns def transform(self, X: pd.DataFrame) -> pd.DataFrame: - """ - Returns the dataframe with the `columns` dropped. + """Returns the dataframe with the `columns` dropped. Args: X (pd.DataFrame): Dataframe to drop columns from. @@ -290,8 +293,9 @@ def transform(self, X: pd.DataFrame) -> pd.DataFrame: class NaNTransformer(BaseTransformer): - """ - Replace NaN values with a specified value. Internally Pandas [`fillna`](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.fillna.html) method is used. + """Replace NaN values with a specified value. Internally Pandas [`fillna`]( + https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.fillna.html) + method is used. Example: ```python @@ -319,8 +323,7 @@ def __init__(self, features: List[Tuple[str, Any]]) -> None: self.features = features def transform(self, X: pd.DataFrame) -> pd.DataFrame: - """ - Replace NaN values with a specified value. + """Replace NaN values with a specified value. Args: X (pandas.DataFrame): Dataframe to transform. @@ -338,12 +341,12 @@ def transform(self, X: pd.DataFrame) -> pd.DataFrame: class ValueIndicatorTransformer(BaseTransformer): - """ - Adds a column to a dataframe indicating if a value is equal to a specified value. - The idea behind this method is, that it is often useful to know if a `NaN` value was - present in the original data and has been changed by some imputation step. - Sometimes the present of a `NaN` value is actually important information. - But obviously this method works with any kind of data. + """Adds a column to a dataframe indicating if a value is equal to a + specified value. The idea behind this method is, that it is often useful to + know if a `NaN` value was present in the original data and has been changed + by some imputation step. Sometimes the present of a `NaN` value is actually + important information. But obviously this method works with any kind of + data. `NaN`, `None` or `np.nan` are **Not** caught by this implementation. @@ -374,8 +377,8 @@ def __init__(self, features: List[Tuple[str, Any]], as_int: bool = False) -> Non self.as_int = as_int def transform(self, X: pd.DataFrame) -> pd.DataFrame: - """ - Add a column to a dataframe indicating if a value is equal to a specified value. + """Add a column to a dataframe indicating if a value is equal to a + specified value. Args: X (pandas.DataFrame): Dataframe to transform. @@ -399,12 +402,12 @@ def transform(self, X: pd.DataFrame) -> pd.DataFrame: class QueryTransformer(BaseTransformer): - """ - Applies a list of queries to a dataframe. - If it operates on a dataset used for supervised learning this transformer should - be applied on the dataframe containing `X` and `y`. So removing of columns by queries - also removes the corresponding `y` value. - Read more about queries [here](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.query.html). + """Applies a list of queries to a dataframe. If it operates on a dataset + used for supervised learning this transformer should be applied on the + dataframe containing `X` and `y`. So removing of columns by queries also + removes the corresponding `y` value. Read more about queries [here](https:/ + + /pandas.pydata.org/docs/reference/api/pandas.DataFrame.query.html). Example: ```python @@ -432,8 +435,7 @@ def __init__(self, queries: List[str]) -> None: self.queries = queries def transform(self, Xy: pd.DataFrame) -> pd.DataFrame: - """ - Applies the list of queries to the dataframe. + """Applies the list of queries to the dataframe. Args: Xy (pd.DataFrame): Dataframe to apply the queries to. For also operating on the target column `y` - if needed. @@ -450,11 +452,13 @@ def transform(self, Xy: pd.DataFrame) -> pd.DataFrame: class ValueReplacerTransformer(BaseTransformer): - r""" - Uses Pandas `replace` method to replace values in a column. This transformer loops over the `features` and applies - `replace` to the according columns. If the column is not from type string but a valid regular expression is provided - the column will be temporarily changed to a string column and after the manipulation by `replace` changed back to its - original type. It may happen, that this type changing fails if the modified column is not compatible with its original type. + r"""Uses Pandas `replace` method to replace values in a column. This + transformer loops over the `features` and applies `replace` to the + according columns. If the column is not from type string but a valid + regular expression is provided the column will be temporarily changed to a + string column and after the manipulation by `replace` changed back to its + original type. It may happen, that this type changing fails if the modified + column is not compatible with its original type. Example: ```python @@ -496,8 +500,7 @@ def __init__(self, features: List[Tuple[List[str], Any, Any]]) -> None: self.features = features def transform(self, X: pd.DataFrame) -> pd.DataFrame: - """ - Replaces a value or regular expression with another value. + """Replaces a value or regular expression with another value. Args: X (pd.DataFrame): Dataframe containing the columns where values should be replaced. @@ -538,10 +541,10 @@ def __check_for_regex(value: Any) -> bool: class LeftJoinTransformer(BaseTransformer): - """ - Performs a database-style left-join using `pd.merge`. This transformer is suitable for - replacing values in a column of a dataframe by looking-up another `pd.DataFrame` - or `pd.Series`. Note that, the join is based on the index of the right dataframe. + """Performs a database-style left-join using `pd.merge`. This transformer + is suitable for replacing values in a column of a dataframe by looking-up + another `pd.DataFrame` or `pd.Series`. Note that, the join is based on the + index of the right dataframe. Example: ```python @@ -575,8 +578,8 @@ def __init__( self.features = features def transform(self, X: pd.DataFrame) -> pd.DataFrame: - """ - Perform a left-join on the given columns of a dataframe with another cooresponding dataframe. + """Perform a left-join on the given columns of a dataframe with another + cooresponding dataframe. Args: X (pd.DataFrame): Dataframe containing the columns to be joined on. diff --git a/src/sk_transformers/number_transformer.py b/src/sk_transformers/number_transformer.py index 77e0cf0..70d2e2d 100644 --- a/src/sk_transformers/number_transformer.py +++ b/src/sk_transformers/number_transformer.py @@ -10,9 +10,14 @@ class MathExpressionTransformer(BaseTransformer): - """ - Applies an function/operation to a column and a given value or column. - The operation can be a function from NumPy's [mathematical functions](https://numpy.org/doc/stable/reference/routines.math.html#mathematical-functions) or [`operator`](https://docs.python.org/3/library/operator.html#module-operator) package. + """Applies an function/operation to a column and a given value or column. + The operation can be a function from NumPy's [mathematical + functions](https. + + ://numpy.org/doc/stable/reference/routines.math.html#mathematical- + functions) or + [`operator`](https://docs.python.org/3/library/operator.html#module- + operator) package. **Warning!** Some functions/operators may not work as expected. Especially not all NumPy methods are supported. For example: various NumPy methods return values which are not fitting the size of the source column. @@ -73,8 +78,7 @@ def __verify_operation(self, operation: str) -> Tuple[bool, Any]: return is_np_op, op def __abbreviate_numpy_in_operation(self, operation: str) -> str: - """ - Replaces `numpy` at the start of a string with `np`. + """Replaces `numpy` at the start of a string with `np`. Args: operation (str): The operation as a string. @@ -88,8 +92,7 @@ def __abbreviate_numpy_in_operation(self, operation: str) -> str: return operation def transform(self, X: pd.DataFrame) -> pd.DataFrame: - """ - Applies the operation to the column and the value. + """Applies the operation to the column and the value. Args: X (pandas.DataFrame): DataFrame containing the columns to apply the operation on. diff --git a/src/sk_transformers/string_transformer.py b/src/sk_transformers/string_transformer.py index 8ca1b6a..abf8654 100644 --- a/src/sk_transformers/string_transformer.py +++ b/src/sk_transformers/string_transformer.py @@ -15,10 +15,10 @@ class IPAddressEncoderTransformer(BaseTransformer): - """ - Encodes IPv4 and IPv6 strings addresses to a float representation. - To shrink the values to a reasonable size IPv4 addresses are divided by 2^10 and IPv6 addresses are divided by 2^48. - Those values can be changed using the `ip4_divisor` and `ip6_divisor` parameters. + """Encodes IPv4 and IPv6 strings addresses to a float representation. To + shrink the values to a reasonable size IPv4 addresses are divided by 2^10 + and IPv6 addresses are divided by 2^48. Those values can be changed using + the `ip4_divisor` and `ip6_divisor` parameters. Example: ```python @@ -56,8 +56,7 @@ def __init__( self.error_value = error_value def transform(self, X: pd.DataFrame) -> pd.DataFrame: - """ - Transforms the column containing the IP addresses to float column. + """Transforms the column containing the IP addresses to float column. Args: X (pandas.DataFrame): DataFrame to transform. @@ -96,8 +95,7 @@ def __to_float( class EmailTransformer(BaseTransformer): - """ - Transforms an email address into multiple features. + """Transforms an email address into multiple features. Example: ```python @@ -125,8 +123,8 @@ def __init__(self, features: List[str]) -> None: self.features = features def transform(self, X: pd.DataFrame) -> pd.DataFrame: - """ - Transforms the one column from X, containing the email addresses, into multiple columns. + """Transforms the one column from X, containing the email addresses, + into multiple columns. Args: X (pandas.DataFrame): DataFrame to transform. @@ -182,8 +180,8 @@ def __num_of_words(string: str) -> int: class StringSimilarityTransformer(BaseTransformer): - """ - Calculates the similarity between two strings using the `gestalt pattern matching` algorithm from the `SequenceMatcher` class. + """Calculates the similarity between two strings using the `gestalt pattern + matching` algorithm from the `SequenceMatcher` class. Example: ```python @@ -215,8 +213,7 @@ def __init__(self, features: Tuple[str, str]) -> None: self.features = features def transform(self, X: pd.DataFrame) -> pd.DataFrame: - """ - Calculates the similarity of two strings provided in `features`. + """Calculates the similarity of two strings provided in `features`. Args: X (pandas.DataFrame): DataFrame to transform. @@ -253,8 +250,7 @@ def __normalize_string(string: str) -> str: class PhoneTransformer(BaseTransformer): - """ - Transforms a phone number into multiple features. + """Transforms a phone number into multiple features. Example: ```python @@ -293,8 +289,7 @@ def __init__( self.error_value = error_value def transform(self, X: pd.DataFrame) -> pd.DataFrame: - """ - Calculates the similarity of two strings provided in `features`. + """Calculates the similarity of two strings provided in `features`. Args: X (pandas.DataFrame): DataFrame to transform. @@ -340,8 +335,8 @@ def __phone_to_float( class StringSlicerTransformer(BaseTransformer): - """ - Slices all entries of specified string features using the `slice()` function. + """Slices all entries of specified string features using the `slice()` + function. Note: The arguments for the `slice()` function are passed as a tuple. This shares the python quirk of writing a tuple with a single argument with the trailing comma. @@ -379,8 +374,7 @@ def __init__( self.features = features def transform(self, X: pd.DataFrame) -> pd.DataFrame: - """ - Slices the strings of specified features in the dataframe. + """Slices the strings of specified features in the dataframe. Args: X (pandas.DataFrame): DataFrame to transform. diff --git a/src/sk_transformers/utils.py b/src/sk_transformers/utils.py index 6e5937c..248b0f0 100644 --- a/src/sk_transformers/utils.py +++ b/src/sk_transformers/utils.py @@ -82,8 +82,8 @@ def check_ready_to_transform( def check_data(X: pd.DataFrame, y: pd.Series, check_nans: bool = True) -> None: - """ - Checks if the data has the correct types, shapes and does not contain any missing values. + """Checks if the data has the correct types, shapes and does not contain + any missing values. Args: X (pandas.DataFrame): The features. @@ -111,9 +111,9 @@ def check_data(X: pd.DataFrame, y: pd.Series, check_nans: bool = True) -> None: def prepare_categorical_data( X: pd.DataFrame, categories: List[Tuple[str, int]] ) -> pd.DataFrame: - """ - Checks for the validity of the categorical features inside the dataframe. - And prepares the data for further processing by changing the `dtypes`. + """Checks for the validity of the categorical features inside the + dataframe. And prepares the data for further processing by changing the + `dtypes`. Args: X (pandas.DataFrame): The dataframe containing the categorical features. diff --git a/tests/test_transformer/test_generic_transformer.py b/tests/test_transformer/test_generic_transformer.py index d892972..2ecfff0 100644 --- a/tests/test_transformer/test_generic_transformer.py +++ b/tests/test_transformer/test_generic_transformer.py @@ -127,7 +127,6 @@ def test_functions_transformer_raises_error(X) -> None: def test_map_transformer_in_pipeline(X) -> None: - pipeline = make_pipeline(MapTransformer([("a", lambda x: x**2)])) result = pipeline.fit_transform(X) expected = np.array([1, 4, 9, 16, 25, 36, 49, 64, 81, 100])