ENH: indexing and __getitem__ of dataframe and series accept zerodim integer np.array as int
- [ ] closes #24919
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry

- Now the `df.iloc`, `df.loc`, `df.__getitem__` accepts zero dim integer numpy  array, as follows:

```python
df.iloc[np.array(0)]
df.loc[np.array(0)]
df[np.array(0)]
```
- I think this change possibly harms the performance of df.iloc
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24924?src=pr&el=h1) Report
> Merging [#24924](https://codecov.io/gh/pandas-dev/pandas/pull/24924?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/539c54f30736b4163b70f1ba903aee7a4243ab1f?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/24924/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/24924?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #24924      +/-   ##
==========================================
+ Coverage   92.38%   92.38%   +<.01%     
==========================================
  Files         166      166              
  Lines       52404    52406       +2     
==========================================
+ Hits        48412    48415       +3     
+ Misses       3992     3991       -1
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.8% <100%> (ø)` | :arrow_up: |
| #single | `42.89% <66.66%> (-0.01%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/24924?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/indexing.py](https://codecov.io/gh/pandas-dev/pandas/pull/24924/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhpbmcucHk=) | `93.88% <100%> (+0.01%)` | :arrow_up: |
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/24924/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `88.13% <0%> (+0.09%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24924?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/24924?src=pr&el=footer). Last update [539c54f...cb98d2a](https://codecov.io/gh/pandas-dev/pandas/pull/24924?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/24924?src=pr&el=h1) Report
> Merging [#24924](https://codecov.io/gh/pandas-dev/pandas/pull/24924?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/659e0cae6be2d7ab3370cc7d8ab936bc3ee1b159?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/24924/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/24924?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #24924      +/-   ##
==========================================
+ Coverage   91.73%   91.73%   +<.01%     
==========================================
  Files         173      173              
  Lines       52839    52842       +3     
==========================================
+ Hits        48472    48476       +4     
+ Misses       4367     4366       -1
```

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

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/24924?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/indexing.py](https://codecov.io/gh/pandas-dev/pandas/pull/24924/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhpbmcucHk=) | `92.29% <100%> (+0.02%)` | :arrow_up: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/24924/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `96.87% <100%> (ø)` | :arrow_up: |
| [pandas/core/generic.py](https://codecov.io/gh/pandas-dev/pandas/pull/24924/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ2VuZXJpYy5weQ==) | `94.16% <0%> (-0.01%)` | :arrow_down: |
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/24924/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `87.66% <0%> (+0.09%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24924?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/24924?src=pr&el=footer). Last update [659e0ca...3242e29](https://codecov.io/gh/pandas-dev/pandas/pull/24924?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
 Just do “key = lib.item_from_zerodim(key)” at the beginning of the method? I like that the test code matches the example code in the issue.  @jbrockmendel thanks for cool function! we *might* have another open issue for something very similar (which this PR could close), if you can do a quick search would be great. This is not really a bug fix, so no need to include in 0.24.1 IMO @jorisvandenbossche I disagree as it is an incorrect behavior. Yes, it is incorrect, but it has been like that forever. And you could also see it as a currently unsupported argument type. This also fails for getitem and loc (so this PR is actually introducing an inconsistency).

Backporting is IMO for regressions and important bug fixes. This is not one of those. @jorisvandenbossche fine, won't fight you on it.

@tamuhey put the whatsnew in 0.25.0 pls. > This also fails for getitem and loc (so this PR is actually introducing an inconsistency).

I think we should actually also consider properly supporting it, if we do down this path. @jreback 
Similar issue is found #21946 > > This also fails for getitem and loc (so this PR is actually introducing an inconsistency).
> 
> I think we should actually also consider properly supporting it, if we do down this path.

@jorisvandenbossche
I added the code and `getitem` and `loc` support it.

Should I rename the title of this PR so that the changes are easy to understand? Yes, changing the title to reflect the changed scope is fine. 
Can you then add a whatsnew notice to v0.25.0.txt ? Changed the title!

> Can you then add a whatsnew notice to v0.25.0.txt ?

Should I modify "doc/source/whatsnew/v0.25.0.rst",or add new txt file to the directory? Ah, no, sorry, I meant the existing `v0.25.0.rst` file! pd.Series also accepts zerodim np.array by the commit 9bd6491759f4ea5733a0fb175df67720206dac4b , so I add some tests and whatsnew docs similar to pd.DataFrame.

```python
sr = pd.Series([1,2,3])
sr[0] # this returns 1
sr[np.array(0)]  # now this also returns 1, but raises an error before this PR
```

np.ndarray accepts zerodim array for indexing as follows:
```python
arr = np.array([1,2,3])
arr[np.array(0)] # this returns 1
``` Hello @tamuhey! Thanks for updating the PR.











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

##### Comment last updated on February 19, 2019 at 23:51 Hours UTC @jreback Is it ok this modification? @jbrockmendel @jreback @jorisvandenbossche @ryanorsinger Sorry, can anyone tell me what should I do next? will have to wait until i merge #25352 to merge master merged! Is it ok? Done! @tamuhey Thanks!