Skip to content

No deprecation warning raised for index - list operation #10038

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

Closed
jorisvandenbossche opened this issue Apr 30, 2015 · 0 comments · Fixed by #10042
Closed

No deprecation warning raised for index - list operation #10038

jorisvandenbossche opened this issue Apr 30, 2015 · 0 comments · Fixed by #10042
Labels
API Design Deprecate Functionality to remove in pandas Indexing Related to indexing on series/frames, not to indexes themselves
Milestone

Comments

@jorisvandenbossche
Copy link
Member

Ilustration:

idx = pd.Index(['a', 'b', 'c', 'd'])
idx - ['a', 'd']
idx - pd.Index(['a', 'd'])

gives:

In [1]: idx = pd.Index(['a', 'b', 'c', 'd'])

In [2]: idx - ['a', 'd']
Out[2]: Index([u'b', u'c'], dtype='object')

In [3]: idx - pd.Index(['a', 'd'])
c:\users\vdbosscj\scipy\pandas-joris\pandas\core\index.py:1192: FutureWarning: u
sing '-' to provide set differences with Indexes is deprecated, use .difference(
)
  "use .difference()",FutureWarning)
Out[3]: Index([u'b', u'c'], dtype='object')

So a list is treated a an index-like (as it performs a set operation), but does not raise a warning as it should (the same for arrays, series).

We have an occurrence in the docs of this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Design Deprecate Functionality to remove in pandas Indexing Related to indexing on series/frames, not to indexes themselves
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant