Dispatch categorical Series ops to Categorical
State: closed

Moving towards the One Implementation To Rule Them All, this has `Series[timedelta64].__cmp__` ops wrap `TimedeltaIndex.__cmp__` and `Series[category].__cmp__` wrap `Categorical.__cmp__`

Fixes (and tests) incorrectly named results when comparing Series/Index objects.

Ref #19513 


Labels:
name: API Design
name: Numeric Operations
description: Arithmetic, Comparison, and Logical operations
name: Categorical
description: Categorical Data Type

Comments:
Hello @jbrockmendel! Thanks for updating the PR.











Cheers ! There are no PEP8 issues in this Pull Request. :beers: 

##### Comment last updated on February 13, 2018 at 16:33 Hours UTC
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/19582?src=pr&el=h1) Report
> Merging [#19582](https://codecov.io/gh/pandas-dev/pandas/pull/19582?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/50528421ae79b27a26b32ba715b17271c8dfda7e?src=pr&el=desc) will **decrease** coverage by `0.01%`.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/19582/graphs/tree.svg?width=650&height=150&src=pr&token=eZ4WkYLtcO)](https://codecov.io/gh/pandas-dev/pandas/pull/19582?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #19582      +/-   ##
==========================================
- Coverage   91.62%   91.61%   -0.02%     
==========================================
  Files         150      150              
  Lines       48773    48872      +99     
==========================================
+ Hits        44687    44772      +85     
- Misses       4086     4100      +14
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.98% <100%> (-0.01%)` | :arrow_down: |
| #single | `41.75% <60%> (+0.01%)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/19582?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/indexes/category.py](https://codecov.io/gh/pandas-dev/pandas/pull/19582/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9jYXRlZ29yeS5weQ==) | `97.31% <100%> (-0.21%)` | :arrow_down: |
| [pandas/core/ops.py](https://codecov.io/gh/pandas-dev/pandas/pull/19582/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvb3BzLnB5) | `96.84% <100%> (+1.62%)` | :arrow_up: |
| [pandas/core/arrays/categorical.py](https://codecov.io/gh/pandas-dev/pandas/pull/19582/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL2NhdGVnb3JpY2FsLnB5) | `94.9% <100%> (+0.16%)` | :arrow_up: |
| [pandas/io/s3.py](https://codecov.io/gh/pandas-dev/pandas/pull/19582/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL3MzLnB5) | `72.72% <0%> (-13.64%)` | :arrow_down: |
| [pandas/io/packers.py](https://codecov.io/gh/pandas-dev/pandas/pull/19582/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL3BhY2tlcnMucHk=) | `87.31% <0%> (-1.34%)` | :arrow_down: |
| [pandas/io/json/json.py](https://codecov.io/gh/pandas-dev/pandas/pull/19582/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2pzb24vanNvbi5weQ==) | `92.23% <0%> (-0.37%)` | :arrow_down: |
| [pandas/io/common.py](https://codecov.io/gh/pandas-dev/pandas/pull/19582/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2NvbW1vbi5weQ==) | `68.77% <0%> (-0.3%)` | :arrow_down: |
| [pandas/io/parquet.py](https://codecov.io/gh/pandas-dev/pandas/pull/19582/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL3BhcnF1ZXQucHk=) | `71.79% <0%> (-0.28%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/19582/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.16% <0%> (-0.27%)` | :arrow_down: |
| ... and [21 more](https://codecov.io/gh/pandas-dev/pandas/pull/19582/diff?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/19582?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/19582?src=pr&el=footer). Last update [5052842...06bd5bb](https://codecov.io/gh/pandas-dev/pandas/pull/19582?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

I suspect this would close an issue or 2 can you have a look.
I didn't see any issues this resolves.  #19513 needs some rulings on whether Categorical behavior should change to match CategoricalIndex or vice-versa.
I think #19513 should be fixed first. This will simplify.
> I think #19513 should be fixed first. This will simplify.

OK.  That will affect the edits here a bit but not a whole lot.  Given I'd like to move forward with fixing comp_method_SERIES for the datetime64 case and _dont_ want multiple PRs touching this code, my preference would be to merge this and follow up when #19513 is resolved.
> OK. That will affect the edits here a bit but not a whole lot. Given I'd like to move forward with fixing comp_method_SERIES for the datetime64 case and dont want multiple PRs touching this code, my preference would be to merge this and follow up when #19513 is resolved.

no I think this will have to wait. moving around code just to move it around doesn't advance things. I would just rebase this after.
There are non-Categorical-specific parts of this I'd like to push through to avoid re-doing when implementing other dtypes (mainly datetime64).  Plus this fixes+tests some currently-incorrect names.  Would this be easier to finish off if I reverted some/all of the Categorical edits?
thanks. pls circle back and see if you can simplify the categorical / CI logic in here (e.g. make consistent / uniform)
> thanks. pls circle back and see if you can simplify the categorical / CI logic in here (e.g. make consistent / uniform)

Yah, this is definitely a goal, is largely dependent on the canonical behavior being clarified in #19513.
i would suggest making ci and categorical have a similar behavior is the first step