BUG: pd.cut with bins=1 and input all 0s
State: closed

The special case of running pd.cut() qith bins=1 an input containing all
0s raises a ValueError

 - [x] closes #15428
closes #15431 
 - [X] tests added / passed
 - [X] passes ``git diff upstream/master | flake8 --diff``
 - [X] whatsnew entry


Labels:
name: Bug
name: Reshaping
description: Concat, Merge/Join, Stack/Unstack, Explode

Comments:
pls add #15428 as a tests case as well
> Regarding the issue #15428 I can add that fix here too but It's a different code bug and it's related to another function (qcut vs cut).

its the same thing. yes please add it.
I am a little confused, it it ok now or is there something still missing?
I am referring to #15431, do you want that issue solved in this PR too, even though it's a different bug?
@luca-s yes its virtually the same issue.
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/15437?src=pr&el=h1) Report
> Merging [#15437](https://codecov.io/gh/pandas-dev/pandas/pull/15437?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/648ae4f03622d8eafe1ca3b833bd6a99f56bece4?src=pr&el=desc) will **decrease** coverage by `-0.03%`.
> The diff coverage is `100%`.


```diff
@@            Coverage Diff             @@
##           master   #15437      +/-   ##
==========================================
- Coverage   91.02%   90.99%   -0.03%     
==========================================
  Files         143      143              
  Lines       49295    49295              
==========================================
- Hits        44869    44857      -12     
- Misses       4426     4438      +12
```


| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/15437?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/tools/tile.py](https://codecov.io/gh/pandas-dev/pandas/compare/648ae4f03622d8eafe1ca3b833bd6a99f56bece4...12489876c0c3c125b209886f5ccd43c461090698?src=pr&el=tree#diff-cGFuZGFzL3Rvb2xzL3RpbGUucHk=) | `96.85% <100%> (ø)` | :white_check_mark: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/compare/648ae4f03622d8eafe1ca3b833bd6a99f56bece4...12489876c0c3c125b209886f5ccd43c461090698?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :x: |
| [pandas/tools/merge.py](https://codecov.io/gh/pandas-dev/pandas/compare/648ae4f03622d8eafe1ca3b833bd6a99f56bece4...12489876c0c3c125b209886f5ccd43c461090698?src=pr&el=tree#diff-cGFuZGFzL3Rvb2xzL21lcmdlLnB5) | `91.76% <0%> (-0.35%)` | :x: |
| [pandas/core/common.py](https://codecov.io/gh/pandas-dev/pandas/compare/648ae4f03622d8eafe1ca3b833bd6a99f56bece4...12489876c0c3c125b209886f5ccd43c461090698?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY29tbW9uLnB5) | `90.96% <0%> (-0.34%)` | :x: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/compare/648ae4f03622d8eafe1ca3b833bd6a99f56bece4...12489876c0c3c125b209886f5ccd43c461090698?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.87% <0%> (-0.1%)` | :x: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/15437?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/15437?src=pr&el=footer). Last update [648ae4f...1248987](https://codecov.io/gh/pandas-dev/pandas/compare/648ae4f03622d8eafe1ca3b833bd6a99f56bece4...12489876c0c3c125b209886f5ccd43c461090698?src=pr&el=footer&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
What about this approach? I added an 'allow' option to _bins_to_cuts function. This might actually be useful as a qcut option too
you'll want to rebase on master as travis was having some issues
What about this new fix attempt? 
@luca-s I like this a lot more! 
All good then? Or is there something missing?
thanks @luca-s 

keep em coming!