dispatch scalar DataFrame ops to Series
State: closed

Many issues closed; will track them down and update.  Will also need whatsnew.

closes #18874
closes #20088
closes #15697
closes #13128
closes #8554
closes #8932
closes #21610 
closes #22005 
closes #22047
closes #22242

This will be less verbose after #22068 implements `ops.dispatch_to_series`.

This still only dispatches a subset of ops.  #22019 dispatches another (disjoint) subset.  After that is another easy-ish case where alignment is known.  Saved for last are cases with ambiguous alignment that is currently done in an ad-hoc best-guess way.

Labels:
name: Refactor
description: Internal refactoring of code
name: Algos
description: Non-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diff

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























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

##### Comment last updated on August 10, 2018 at 14:11 Hours UTC
Uses too many kludges, should wait for fixes in series and index comparisons.  Closing.
Re-opening after scaling back an unreasonably ambitious py2/py3 compat goal.  In particular consider:

```
df = pd.Series(['bar', 'bar'], name='foo').to_frame()
df < 0
df['foo'] < 0
```

In PY3 ATM this gives:
```
>>> df < 0
    foo
0  True
1  True
>>> df['foo'] < 0
[...]
TypeError: '<' not supported between instances of 'str' and 'int'
```

And in PY2:
```
>>> df < 0
     foo
0  False
1  False
>>> df['foo'] < 0
0    False
1    False
Name: foo, dtype: bool
```

Making the PY2/PY3 behavior identical is not feasible, but we can (and this PR does) ensure that the DataFrame/Series behavior matches.  In PY2 this is unchanged, in PY3 the DataFrame comparison now correctly raises.
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/22163?src=pr&el=h1) Report
> Merging [#22163](https://codecov.io/gh/pandas-dev/pandas/pull/22163?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/cc3ab4adf89911a90f7093e88338ef2cfb8f86be?src=pr&el=desc) will **decrease** coverage by `0.03%`.
> The diff coverage is `100%`.

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

```diff
@@            Coverage Diff             @@
##           master   #22163      +/-   ##
==========================================
- Coverage   92.08%   92.05%   -0.04%     
==========================================
  Files         169      169              
  Lines       50694    50700       +6     
==========================================
- Hits        46682    46672      -10     
- Misses       4012     4028      +16
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.46% <100%> (-0.04%)` | :arrow_down: |
| #single | `42.26% <80%> (-0.08%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/22163?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/ops.py](https://codecov.io/gh/pandas-dev/pandas/pull/22163/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvb3BzLnB5) | `96.71% <100%> (+0.14%)` | :arrow_up: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/22163/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.26% <100%> (ø)` | :arrow_up: |
| [pandas/core/internals/blocks.py](https://codecov.io/gh/pandas-dev/pandas/pull/22163/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW50ZXJuYWxzL2Jsb2Nrcy5weQ==) | `93.83% <0%> (-0.81%)` | :arrow_down: |
| [pandas/core/dtypes/missing.py](https://codecov.io/gh/pandas-dev/pandas/pull/22163/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZHR5cGVzL21pc3NpbmcucHk=) | `92.98% <0%> (-0.59%)` | :arrow_down: |
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/22163/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `85.69% <0%> (-0.21%)` | :arrow_down: |
| [pandas/core/generic.py](https://codecov.io/gh/pandas-dev/pandas/pull/22163/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ2VuZXJpYy5weQ==) | `96.42% <0%> (-0.05%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/22163?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/22163?src=pr&el=footer). Last update [cc3ab4a...9b62135](https://codecov.io/gh/pandas-dev/pandas/pull/22163?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

Updated OP with issues this closes
Phew.  Just added GH references to tests and a ton of Whats New.
needs a rebase and some comments.
needs rebase again
thanks @jbrockmendel 

nice squashings!