From cbaf6a692196ca4a08bcd009be842045657cf265 Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Thu, 19 Sep 2019 13:59:03 +0200 Subject: [PATCH 1/2] COMPAT: ensure no warnings on tab completion with Jedi 0.15 --- pandas/core/generic.py | 2 +- pandas/core/indexes/base.py | 2 +- pandas/core/series.py | 8 +++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 7e77c56fefe04..152983451bc38 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -166,7 +166,7 @@ class NDFrame(PandasObject, SelectionMixin): _internal_names_set = set(_internal_names) # type: Set[str] _accessors = set() # type: Set[str] _deprecations = frozenset( - ["as_blocks", "blocks", "is_copy"] + ["as_blocks", "blocks", "is_copy", "ftypes", "ix"] ) # type: FrozenSet[str] _metadata = [] # type: List[str] _is_copy = None diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index 6ef9d78ff9e97..f5f7056d8bbcf 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -205,7 +205,7 @@ class Index(IndexOpsMixin, PandasObject): """ # tolist is not actually deprecated, just suppressed in the __dir__ - _deprecations = DirNamesMixin._deprecations | frozenset(["tolist"]) + _deprecations = DirNamesMixin._deprecations | frozenset(["tolist", "dtype_str"]) # To hand over control to subclasses _join_precedence = 1 diff --git a/pandas/core/series.py b/pandas/core/series.py index b0616c053df6d..2431bfcfd0356 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -54,7 +54,7 @@ import pandas as pd from pandas.core import algorithms, base, generic, nanops, ops -from pandas.core.accessor import CachedAccessor +from pandas.core.accessor import CachedAccessor, DirNamesMixin from pandas.core.arrays import ExtensionArray from pandas.core.arrays.categorical import Categorical, CategoricalAccessor from pandas.core.arrays.sparse import SparseAccessor @@ -176,8 +176,10 @@ class Series(base.IndexOpsMixin, generic.NDFrame): _metadata = ["name"] _accessors = {"dt", "cat", "str", "sparse"} # tolist is not actually deprecated, just suppressed in the __dir__ - _deprecations = generic.NDFrame._deprecations | frozenset( - ["asobject", "reshape", "valid", "tolist"] + _deprecations = ( + generic.NDFrame._deprecations + | DirNamesMixin._deprecations + | frozenset(["asobject", "reshape", "valid", "tolist", "ftype", "real", "imag"]) ) # Override cache_readonly bc Series is mutable From 74a5832c07f7685db0f5ff130e70bbc6f99aeaac Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Thu, 19 Sep 2019 14:02:14 +0200 Subject: [PATCH 2/2] add whatsnew --- doc/source/whatsnew/v0.25.2.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/source/whatsnew/v0.25.2.rst b/doc/source/whatsnew/v0.25.2.rst index de411ef63680a..14682b706f924 100644 --- a/doc/source/whatsnew/v0.25.2.rst +++ b/doc/source/whatsnew/v0.25.2.rst @@ -100,7 +100,8 @@ Other ^^^^^ - Compatibility with Python 3.8 in :meth:`DataFrame.query` (:issue:`27261`) -- +- Fix to ensure that tab-completion in an IPython console does not raise + warnings for deprecated attributes (:issue:`27900`). .. _whatsnew_0.252.contributors: