diff --git a/pandas/__init__.py b/pandas/__init__.py index 4e1bcbd613965..bdc19d2e515f1 100644 --- a/pandas/__init__.py +++ b/pandas/__init__.py @@ -74,8 +74,11 @@ parser = _DeprecatedModule(deprmod='pandas.parser', removals=['na_values'], moved={'CParserError': 'pandas.errors.ParserError'}) -lib = _DeprecatedModule(deprmod='pandas.lib', deprmodto='pandas._libs.lib', - moved={'infer_dtype': 'pandas.api.lib.infer_dtype'}) +lib = _DeprecatedModule(deprmod='pandas.lib', deprmodto=False, + moved={'Timestamp': 'pandas.Timestamp', + 'Timedelta': 'pandas.Timedelta', + 'NaT': 'pandas.NaT', + 'infer_dtype': 'pandas.api.lib.infer_dtype'}) tslib = _DeprecatedModule(deprmod='pandas.tslib', moved={'Timestamp': 'pandas.Timestamp', 'Timedelta': 'pandas.Timedelta', diff --git a/pandas/util/depr_module.py b/pandas/util/depr_module.py index 1f428198c19f3..b438c91d980af 100644 --- a/pandas/util/depr_module.py +++ b/pandas/util/depr_module.py @@ -75,15 +75,22 @@ def __getattr__(self, name): FutureWarning, stacklevel=2) else: deprmodto = self.deprmodto - if deprmodto is None: - deprmodto = "{modname}.{name}".format( - modname=obj.__module__, name=name) - # The object is actually located in another module. - warnings.warn( - "{deprmod}.{name} is deprecated. Please use " - "{deprmodto}.{name} instead.".format( - deprmod=self.deprmod, name=name, deprmodto=deprmodto), - FutureWarning, stacklevel=2) + if deprmodto is False: + warnings.warn( + "{deprmod}.{name} is deprecated and will be removed in " + "a future version.".format( + deprmod=self.deprmod, name=name), + FutureWarning, stacklevel=2) + else: + if deprmodto is None: + deprmodto = "{modname}.{name}".format( + modname=obj.__module__, name=name) + # The object is actually located in another module. + warnings.warn( + "{deprmod}.{name} is deprecated. Please use " + "{deprmodto}.{name} instead.".format( + deprmod=self.deprmod, name=name, deprmodto=deprmodto), + FutureWarning, stacklevel=2) return obj