Column-wise replace all ``NaNs``, ``-inf`` and ``+inf`` in the DataFrame `X` with average/extreme
            values from the provided dictionaries.

            :param X: DataFrame to impute
            :type X: pandas.DataFrame

            :return: imputed DataFrame
            :rtype: pandas.DataFrame
            :raise RuntimeError: if the replacement dictionaries are still of None type.
             This can happen if the transformer was not fitted.

def transform(self, X):
            """
            Column-wise replace all ``NaNs``, ``-inf`` and ``+inf`` in the DataFrame `X` with average/extreme
            values from the provided dictionaries.

            :param X: DataFrame to impute
            :type X: pandas.DataFrame

            :return: imputed DataFrame
            :rtype: pandas.DataFrame
            :raise RuntimeError: if the replacement dictionaries are still of None type.
             This can happen if the transformer was not fitted.
            """

            if not isinstance(X, pd.DataFrame):
                X = pd.DataFrame(X)

            if self._col_to_NINF_repl is None or self._col_to_PINF_repl is None or self._col_to_NAN_repl is None:
                raise NotFittedError("PerColumnImputer is not fitted")

            X = impute_dataframe_range(X, self._col_to_PINF_repl, self._col_to_NINF_repl, self._col_to_NAN_repl)

            return X