allow using Iterable in Series and DataFrame constructor
State: closed

- [X] closes #2193
- [x] tests added / passed
- [X] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry
---

@TomAugspurger Hope you can review this.

BTW, perhpas you may want to change `Iterable` in `is_list_like()` to `Sequence`.

```python
gen = (i for i in range(10))
pandas.core.dtypes.inference.is_list_like(gen)
# True
len(gen)
# Traceback (most recent call last):
#   File "<stdin>", line 1, in <module>
# TypeError: object of type 'generator' has no len()
gen[0]
# Traceback (most recent call last):
#   File "<stdin>", line 1, in <module>
# TypeError: 'generator' object is not subscriptable
```


Labels:
name: Enhancement
name: Internals
description: Related to non-user accessible pandas implementation

Comments:
This test failed. But a single-column `DataFrame` seems reasonable to me.
https://github.com/pandas-dev/pandas/blob/27ebb3e1e40513ad5f8919a5bbc7298e2e070a39/pandas/tests/frame/test_constructors.py#L868-L872
```python
pd.DataFrame((1, 2, 3))
#   0
#0  1
#1  2
#2  3
```
Allow `pd.DataFrame((1, 2, 3))` because `pd.DataFrame([1, 2, 3])` is valid. They should be the same.
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/21987?src=pr&el=h1) Report
> Merging [#21987](https://codecov.io/gh/pandas-dev/pandas/pull/21987?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/693e2353175592e9cb0e11be8d087541b17bda71?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/21987/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/21987?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #21987      +/-   ##
==========================================
- Coverage   92.02%   92.02%   -0.01%     
==========================================
  Files         170      170              
  Lines       50707    50704       -3     
==========================================
- Hits        46661    46658       -3     
  Misses       4046     4046
```

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

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/21987?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/series.py](https://codecov.io/gh/pandas-dev/pandas/pull/21987/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvc2VyaWVzLnB5) | `94.11% <100%> (ø)` | :arrow_up: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/21987/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.19% <100%> (-0.01%)` | :arrow_down: |

------

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

> Allow pd.DataFrame((1, 2, 3)) because pd.DataFrame([1, 2, 3]) is valid. They should be the same.

Context: That goes back a long way to DataMatrix: https://github.com/pandas-dev/pandas/commit/c34ac749382c2046548eb2470eb847d66ecc6d23#diff-225c6e44f997b9b698ab52a48b223018R39

+1 for allowing it.
will have a look

don’t merge
thanks @holymonson !