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
merged 2 commits into from May 21, 2018

Conversation

Projects
None yet
4 participants
@topper-123
Contributor

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.

@jreback

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

This comment has been minimized.

Contributor

topper-123 commented May 18, 2018

Not able to locate t. Where its name?

@codecov

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

Contributor

topper-123 commented May 19, 2018

test added. Is the location ok?

@topper-123

This comment has been minimized.

Contributor

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

This comment has been minimized.

Contributor

jreback commented May 19, 2018

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

@topper-123

This comment has been minimized.

Contributor

topper-123 commented May 19, 2018

green.

@jreback jreback merged commit 0ebbafd into pandas-dev:master May 21, 2018

3 checks passed

ci/circleci Your tests passed on CircleCI!
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@jreback

This comment has been minimized.

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'])

This comment has been minimized.

@jorisvandenbossche

jorisvandenbossche May 28, 2018

Member

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 added a commit to jorisvandenbossche/pandas that referenced this pull request Jun 8, 2018

jorisvandenbossche added a commit that referenced this pull request Jun 9, 2018

david-liu-brattle-1 added a commit to david-liu-brattle-1/pandas that referenced this pull request Jun 18, 2018

@topper-123 topper-123 deleted the topper-123:add_to_index_attributes_deprecations branch Oct 27, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment