API: Make Series.searchsorted return a scalar, when supplied a scalar
State: closed

- [x] xref #23466 & #22034
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry

``Series.searchsorted`` returns the wrong shape for scalar input. Numpy arrays and all other array types return a scalar if the input is a scalar, but ``Series`` does not.

For example:

```python
>>> import numpy as np
>>> np.array([1, 2, 3]).searchsorted(1)
0
>>> np.array([1, 2, 3]).searchsorted([1])
array([0])
>>> import pandas as pd
>>> d = pd.date_range('2018', periods=4)
>>> d.searchsorted(d[0])
0
>>> d.searchsorted(d[:1])
array([0])

>>> n = 100_000
>>> s = pd.Series(([0]*n + [1]*n + + [2]*n))
>>> s.searchsorted(1)
array([100000], dtype=int32)  # master
100000  # this PR. Scalar input should lead to scalar output
>>> s.searchsorted([1])
array([100000], dtype=int32)  # master and this PR
```


Labels:
name: Reshaping
description: Concat, Merge/Join, Stack/Unstack, Explode
name: Dtype Conversions
description: Unexpected or buggy dtype conversions

Comments:
Hello @topper-123! Thanks for updating the PR.

 - There are no PEP8 issues in the file [`pandas/core/base.py`](https://github.com/topper-123/pandas/blob/ef5c259606460fdfed473c809e200617cbe27c57/pandas/core/base.py) !

 - There are no PEP8 issues in the file [`pandas/core/series.py`](https://github.com/topper-123/pandas/blob/ef5c259606460fdfed473c809e200617cbe27c57/pandas/core/series.py) !

 - There are no PEP8 issues in the file [`pandas/tests/arrays/categorical/test_analytics.py`](https://github.com/topper-123/pandas/blob/ef5c259606460fdfed473c809e200617cbe27c57/pandas/tests/arrays/categorical/test_analytics.py) !

 - There are no PEP8 issues in the file [`pandas/tests/series/test_analytics.py`](https://github.com/topper-123/pandas/blob/ef5c259606460fdfed473c809e200617cbe27c57/pandas/tests/series/test_analytics.py) !

 - There are no PEP8 issues in the file [`pandas/util/testing.py`](https://github.com/topper-123/pandas/blob/ef5c259606460fdfed473c809e200617cbe27c57/pandas/util/testing.py) !



##### Comment last updated on November 20, 2018 at 00:41 Hours UTC
TheTravis failure is unrelated (hypothesis related)

```
>   @given(index=indices(max_length=5), num_columns=integers(0, 5))
>   def test_frequency_is_original(self, index, num_columns):
pandas/tests/frame/test_apply.py:1160: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../miniconda3/envs/pandas/lib/python2.7/site-packages/hypothesis/core.py:638: in execute
    ) % (test.__name__, text_repr[0],))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <hypothesis.core.StateForActualGivenExecution object at 0x7f2c035ae050>
message = "Hypothesis test_frequency_is_original(self=<pandas.tests.frame.test_apply.TestDataFrameAggregate instance at 0x7f2c3f...', freq=None), num_columns=3) produces unreliable results: Falsified on the first call but did not on a subsequent one"
    def __flaky(self, message):
        if len(self.falsifying_examples) <= 1:
>           raise Flaky(message)
E           Flaky: Hypothesis test_frequency_is_original(self=<pandas.tests.frame.test_apply.TestDataFrameAggregate instance at 0x7f2c3f1955a8>, index=DatetimeIndex(['2237-05-12', '2237-05-13', '2237-05-14', '2237-05-15'], dtype='datetime64[ns]', freq=None), num_columns=3) produces unreliable results: Falsified on the first call but did not on a subsequent one
../../../miniconda3/envs/pandas/lib/python2.7/site-packages/hypothesis/core.py:884: Flaky
```
@topper-123 happy to have this if it can be done in a reasonbale way. pls update or close.
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/23801?src=pr&el=h1) Report
> Merging [#23801](https://codecov.io/gh/pandas-dev/pandas/pull/23801?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/77278ba8158457f142e6bba19e6d53a66a3f1322?src=pr&el=desc) will **increase** coverage by `0.07%`.
> The diff coverage is `100%`.

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

```diff
@@            Coverage Diff             @@
##           master   #23801      +/-   ##
==========================================
+ Coverage   92.21%   92.28%   +0.07%     
==========================================
  Files         162      161       -1     
  Lines       51723    51459     -264     
==========================================
- Hits        47695    47491     -204     
+ Misses       4028     3968      -60
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.68% <100%> (+0.07%)` | :arrow_up: |
| #single | `42.31% <33.33%> (-0.73%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/23801?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/base.py](https://codecov.io/gh/pandas-dev/pandas/pull/23801/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYmFzZS5weQ==) | `97.61% <ø> (-0.03%)` | :arrow_down: |
| [pandas/core/series.py](https://codecov.io/gh/pandas-dev/pandas/pull/23801/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvc2VyaWVzLnB5) | `93.68% <100%> (-0.02%)` | :arrow_down: |
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/23801/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `86.05% <100%> (-1.36%)` | :arrow_down: |
| [pandas/core/sparse/scipy\_sparse.py](https://codecov.io/gh/pandas-dev/pandas/pull/23801/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvc3BhcnNlL3NjaXB5X3NwYXJzZS5weQ==) | `97.05% <0%> (-2.95%)` | :arrow_down: |
| [pandas/io/common.py](https://codecov.io/gh/pandas-dev/pandas/pull/23801/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2NvbW1vbi5weQ==) | `70.54% <0%> (-1.56%)` | :arrow_down: |
| [pandas/io/html.py](https://codecov.io/gh/pandas-dev/pandas/pull/23801/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2h0bWwucHk=) | `91.2% <0%> (-1.47%)` | :arrow_down: |
| [pandas/core/dtypes/common.py](https://codecov.io/gh/pandas-dev/pandas/pull/23801/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZHR5cGVzL2NvbW1vbi5weQ==) | `94.37% <0%> (-1.26%)` | :arrow_down: |
| [pandas/core/indexes/timedeltas.py](https://codecov.io/gh/pandas-dev/pandas/pull/23801/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy90aW1lZGVsdGFzLnB5) | `89.26% <0%> (-1.16%)` | :arrow_down: |
| [pandas/io/formats/html.py](https://codecov.io/gh/pandas-dev/pandas/pull/23801/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2Zvcm1hdHMvaHRtbC5weQ==) | `97.68% <0%> (-0.93%)` | :arrow_down: |
| ... and [89 more](https://codecov.io/gh/pandas-dev/pandas/pull/23801/diff?src=pr&el=tree-more) | |

------

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

# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/23801?src=pr&el=h1) Report
> Merging [#23801](https://codecov.io/gh/pandas-dev/pandas/pull/23801?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/04a0eacfb2df7c42700badccbc3ea857d392ffb7?src=pr&el=desc) will **increase** coverage by `<.01%`.
> The diff coverage is `100%`.

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

```diff
@@            Coverage Diff             @@
##           master   #23801      +/-   ##
==========================================
+ Coverage   92.29%   92.29%   +<.01%     
==========================================
  Files         162      162              
  Lines       51845    51846       +1     
==========================================
+ Hits        47852    47853       +1     
  Misses       3993     3993
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.7% <100%> (ø)` | :arrow_up: |
| #single | `42.97% <16.66%> (-0.01%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/23801?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/series.py](https://codecov.io/gh/pandas-dev/pandas/pull/23801/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvc2VyaWVzLnB5) | `93.71% <100%> (ø)` | :arrow_up: |
| [pandas/core/base.py](https://codecov.io/gh/pandas-dev/pandas/pull/23801/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYmFzZS5weQ==) | `97.66% <100%> (ø)` | :arrow_up: |

------

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

I've updated the PR.
Is thia ok? This would make the searchsorted method for all of the pandas objects return scalars for scalar inputs and make the API consistent.
this PR looked ok, merge master.
Rebased.