Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
API/DEPR: Remove +/- as setops for Index (GH8227) #14127
Conversation
jorisvandenbossche
added API Design Clean
labels
Aug 31, 2016
jorisvandenbossche
added this to the
0.19.0
milestone
Aug 31, 2016
jreback
and 1 other
commented on an outdated diff
Aug 31, 2016
| return Index(other + np.array(self)) | ||
| __iadd__ = __add__ | ||
| - def __sub__(self, other): |
jreback
Contributor
|
jreback
commented on the diff
Aug 31, 2016
| @@ -1745,29 +1745,13 @@ def argsort(self, *args, **kwargs): | ||
| return result.argsort(*args, **kwargs) | ||
| def __add__(self, other): | ||
| - if is_list_like(other): | ||
| - warnings.warn("using '+' to provide set union with Indexes is " | ||
| - "deprecated, use '|' or .union()", FutureWarning, | ||
| - stacklevel=2) | ||
| - if isinstance(other, Index): |
jorisvandenbossche
Owner
|
jreback
commented on an outdated diff
Aug 31, 2016
codecov-io
commented
Aug 31, 2016
•
Current coverage is 85.25% (diff: 100%)@@ master #14127 diff @@
==========================================
Files 139 139
Lines 50501 50495 -6
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
- Hits 43058 43051 -7
- Misses 7443 7444 +1
Partials 0 0
|
|
@jorisvandenbossche we should do this for the RC as well. |
|
@jreback yep, as it is quite a substantial change (for people that ignored the warnings) Is there a reason that we do not allow numeric ops for the base Index class? (eg Because eg the |
|
I think we don't allow numeric operations on Index as only possible one is add for string concat in general these r not well defined so no reason to allow |
|
I think we should let the objects in the Index decide whether the numeric operation is valid or not. This is the approach NumPy uses for object dtype. For example, one might put decimal objects in a pandas.Index. |
|
the numpy approach leads to lots of bugs and edge cases - constraining things somewhat to not allowing everything on everything is much more user friendly decimal objects in an Index are a disaster - should not be encouraged |
jreback
and 1 other
commented on an outdated diff
Aug 31, 2016
| @@ -878,6 +878,31 @@ of ``int64`` (:issue:`13988`) | ||
| pi = pd.PeriodIndex(['2011-01', '2011-02'], freq='M') | ||
| pi.values | ||
| +.. _whatsnew_0190.api.setops: | ||
| + | ||
| +Index ``+`` / ``-`` no longer used for set operations | ||
| +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| + | ||
| +Addition and subtraction of certain Index types performed set operations | ||
| +(set union and difference). This behaviour was already deprecated since 0.15.0, | ||
| +and is now disabled and, when possible, ``+`` | ||
| +and ``-`` are used for numeric operations (:issue:`8227`, :issue:`14127`). |
jreback
Contributor
|
jorisvandenbossche
changed the title from
[WIP] API/DEPR: Remove +/- as setops for Index (GH8227) to API/DEPR: Remove +/- as setops for Index (GH8227)
Sep 1, 2016
jorisvandenbossche
modified the milestone: 0.19.0, 0.19.0rc
Sep 1, 2016
jreback
commented on the diff
Sep 2, 2016
| +Index ``+`` / ``-`` no longer used for set operations | ||
| +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| + | ||
| +Addition and subtraction of certain Index types performed set operations | ||
| +(set union and difference). This behaviour was already deprecated since 0.15.0, | ||
| +and is now disabled and, when possible, ``+`` | ||
| +and ``-`` are used for numeric operations (:issue:`8227`, :issue:`14127`). | ||
| + | ||
| +Previous Behavior: | ||
| + | ||
| +.. code-block:: ipython | ||
| + | ||
| + In [1]: pd.Index(['a', 'b']) + pd.Index(['a', 'c']) | ||
| + FutureWarning: using '+' to provide set union with Indexes is deprecated, use '|' or .union() | ||
| + Out[1]: Index(['a', 'b', 'c'], dtype='object') | ||
| + |
jreback
Contributor
|
jreback
commented on an outdated diff
Sep 2, 2016
| @@ -878,6 +878,31 @@ of ``int64`` (:issue:`13988`) | ||
| pi = pd.PeriodIndex(['2011-01', '2011-02'], freq='M') | ||
| pi.values | ||
| +.. _whatsnew_0190.api.setops: | ||
| + | ||
| +Index ``+`` / ``-`` no longer used for set operations | ||
| +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| + | ||
| +Addition and subtraction of certain Index types performed set operations |
|
|
|
@jorisvandenbossche some small comments, but otherwise lgtm. merge when ready. |
jreback
referenced
this pull request
Sep 4, 2016
Open
DEPR: deprecations log for removed issues #13777
jorisvandenbossche
merged commit 8023029
into pandas-dev:master
Sep 6, 2016
jorisvandenbossche
modified the milestone: 0.19.0rc, 0.19.0
Sep 7, 2016
trbs
added a commit
to trbs/pandas
that referenced
this pull request
Sep 12, 2016
|
|
trbs |
8ab1250
|
trbs
added a commit
to trbs/pandas
that referenced
this pull request
Sep 12, 2016
|
|
trbs |
a092198
|
jorisvandenbossche commentedAug 31, 2016
•
edited
xref #13777, deprecations put in place in #8227
git diff upstream/master | flake8 --diff