__init__.py 943 B

123456789101112131415161718192021222324
  1. """Transformers for missing value imputation"""
  2. import typing
  3. from ._base import MissingIndicator, SimpleImputer
  4. from ._knn import KNNImputer
  5. if typing.TYPE_CHECKING:
  6. # Avoid errors in type checkers (e.g. mypy) for experimental estimators.
  7. # TODO: remove this check once the estimator is no longer experimental.
  8. from ._iterative import IterativeImputer # noqa
  9. __all__ = ["MissingIndicator", "SimpleImputer", "KNNImputer"]
  10. # TODO: remove this check once the estimator is no longer experimental.
  11. def __getattr__(name):
  12. if name == "IterativeImputer":
  13. raise ImportError(
  14. f"{name} is experimental and the API might change without any "
  15. "deprecation cycle. To use it, you need to explicitly import "
  16. "enable_iterative_imputer:\n"
  17. "from sklearn.experimental import enable_iterative_imputer"
  18. )
  19. raise AttributeError(f"module {__name__} has no attribute {name}")