Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEPR: Add deprecated index attribute names to deprecation list #21125

Merged

Conversation

topper-123
Copy link
Contributor

@topper-123 topper-123 commented May 18, 2018

In ipython, when you press tab (e.g. idx.<tab>) a long list of deprecations shows up:

C:\Users\TP\Miniconda3\envs\pandas-dev\lib\site-packages\jedi\evaluate\compiled\__init__.py:328: FutureWarning: Int64Index.base is deprecated and will be removed in a future version
  getattr(obj, name)
C:\Users\TP\Miniconda3\envs\pandas-dev\lib\site-packages\jedi\evaluate\compiled\__init__.py:328: FutureWarning: Int64Index.data is deprecated and will be removed in a future version
  getattr(obj, name)
C:\Users\TP\Miniconda3\envs\pandas-dev\lib\site-packages\jedi\evaluate\compiled\__init__.py:328: FutureWarning: Int64Index.flags is deprecated and will be removed in a future version
  getattr(obj, name)
C:\Users\TP\Miniconda3\envs\pandas-dev\lib\site-packages\jedi\evaluate\compiled\__init__.py:328: FutureWarning: Int64Index.itemsize is deprecated and will be removed in a future version
  getattr(obj, name)
C:\Users\TP\Miniconda3\envs\pandas-dev\lib\site-packages\jedi\evaluate\compiled\__init__.py:328: FutureWarning: Int64Index.strides is deprecated and will be removed in a future version
  getattr(obj, name)

With this PR we avoid getting that list of deprecations in iPython.

I'm not sure if/where this should go in the whatsnew document.

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we have a test for exactly this but for Series (and for the main object not accessors)

can u add one here

@topper-123
Copy link
Contributor Author

Not able to locate t. Where its name?

@codecov
Copy link

codecov bot commented May 18, 2018

Codecov Report

Merging #21125 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #21125   +/-   ##
=======================================
  Coverage   91.84%   91.84%           
=======================================
  Files         153      153           
  Lines       49499    49499           
=======================================
  Hits        45460    45460           
  Misses       4039     4039
Flag Coverage Δ
#multiple 90.23% <100%> (ø) ⬆️
#single 41.88% <100%> (ø) ⬆️
Impacted Files Coverage Δ
pandas/core/accessor.py 98.71% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bc37ea2...a54b416. Read the comment docs.

@jschendel
Copy link
Member

jschendel commented May 18, 2018

I think this is the test @jreback is referring to:

def test_tab_complete_warning(self, ip):
# https://github.com/pandas-dev/pandas/issues/16409
pytest.importorskip('IPython', minversion="6.0.0")
from IPython.core.completer import provisionalcompleter
code = "import pandas as pd; s = pd.Series()"
ip.run_code(code)
with tm.assert_produces_warning(None):
with provisionalcompleter('ignore'):
list(ip.Completer.completions('s.', 1))

There are also instances of this test (same name) in frame\test_api.py and categorical\test_warnings.py

@topper-123
Copy link
Contributor Author

test added. Is the location ok?

@topper-123
Copy link
Contributor Author

topper-123 commented May 19, 2018

BTW, @jschendel in line 474 in the test_api.py file you showed

with tm.assert_produces_warning(None):
with provisionalcompleter('ignore'):
list(ip.Completer.completions('s.', 1))

I think list(ip.Completer.completions('s.', 1)) should be list(ip.Completer.completions('s.', 2)) in order to produce the warnings, do you not agree? With 1 the tab is pressed after 's' which is too early.

@jreback
Copy link
Contributor

jreback commented May 19, 2018

looks ok. can you add a whatsnew note (0.23.1)

@jreback jreback added Output-Formatting __repr__ of pandas objects, to_string Deprecate Functionality to remove in pandas labels May 19, 2018
@jreback jreback added this to the 0.23.1 milestone May 19, 2018
@topper-123 topper-123 force-pushed the add_to_index_attributes_deprecations branch from 00eb63c to 93d5f33 Compare May 19, 2018 18:49
@topper-123
Copy link
Contributor Author

green.

@topper-123 topper-123 force-pushed the add_to_index_attributes_deprecations branch from 93d5f33 to a54b416 Compare May 19, 2018 23:17
@jreback jreback merged commit 0ebbafd into pandas-dev:master May 21, 2018
@jreback
Copy link
Contributor

jreback commented May 21, 2018

thanks!

@@ -12,7 +12,8 @@

class DirNamesMixin(object):
_accessors = frozenset([])
_deprecations = frozenset(['asobject'])
_deprecations = frozenset(
['asobject', 'base', 'data', 'flags', 'itemsize', 'strides'])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, this only adds them to Index, not to Series.
So not sure why you did get warnings for Index, but not for Series in the first place.

jorisvandenbossche pushed a commit to jorisvandenbossche/pandas that referenced this pull request Jun 8, 2018
jorisvandenbossche pushed a commit that referenced this pull request Jun 9, 2018
david-liu-brattle-1 pushed a commit to david-liu-brattle-1/pandas that referenced this pull request Jun 18, 2018
@topper-123 topper-123 deleted the add_to_index_attributes_deprecations branch October 27, 2018 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Deprecate Functionality to remove in pandas Output-Formatting __repr__ of pandas objects, to_string
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants