BUG: fix DataFrame.__getitem__ and .loc with non-list listlikes
State: closed

- [x] closes #21294
- [x] closes #21428
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry

xref #21309 , but worth fixing separately

Labels:
name: Indexing
description: Related to indexing on series/frames, not to indexes themselves

Comments:
this would have to be for 0.24 (not convinced we should do this)
> not convinced we should do this

Do you think we should _disable_ listlikes in other cases? Or you don't find the discrepancy problematic?
Hello @toobaz! Thanks for updating the PR.









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

##### Comment last updated on July 07, 2018 at 08:11 Hours UTC
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/21313?src=pr&el=h1) Report
> Merging [#21313](https://codecov.io/gh/pandas-dev/pandas/pull/21313?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/620abc403d371446afe38fc1e63f0d90ea27b80a?src=pr&el=desc) will **decrease** coverage by `<.01%`.
> The diff coverage is `100%`.

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

```diff
@@            Coverage Diff             @@
##           master   #21313      +/-   ##
==========================================
- Coverage   91.95%   91.95%   -0.01%     
==========================================
  Files         160      160              
  Lines       49820    49818       -2     
==========================================
- Hits        45812    45809       -3     
- Misses       4008     4009       +1
```

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

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/21313?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/21313/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.19% <100%> (ø)` | :arrow_up: |
| [pandas/core/sparse/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/21313/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvc3BhcnNlL2ZyYW1lLnB5) | `94.78% <100%> (-0.06%)` | :arrow_down: |
| [pandas/core/internals.py](https://codecov.io/gh/pandas-dev/pandas/pull/21313/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW50ZXJuYWxzLnB5) | `95.46% <0%> (-0.08%)` | :arrow_down: |
| [pandas/core/indexes/category.py](https://codecov.io/gh/pandas-dev/pandas/pull/21313/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9jYXRlZ29yeS5weQ==) | `97.28% <0%> (+0.27%)` | :arrow_up: |

------

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

@jreback ready for me
I have my doubts we should do this, commented on the relevant issue: https://github.com/pandas-dev/pandas/issues/21294
Discussion (I think) concluded, conflicts fixed by rebasing... ready for me. Objections @jreback ?
@jreback added a comment clarifying the ``except`` clause, rebased, ready for me
> ok lgtm. can you add a whatsnew, maybe needs a subsection.

I don't think a subsection is worth putting in the whatsnew - because the change is relatively marginal. But I do think we'll need to clarify list-likes in general in the docs - see #21784
thanks @toobaz nice!