BUG: fix df.where(cond) when cond is empty
- when cond is empty, cond.dtypes are objects, which raised
`ValueError: Boolean array expected for the condition, not object
`
- [ ] closes #xxxxx 
- [ ] tests added / passed
- [ ] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry

@pajachiet : Thanks for the PR!  Can you add a test and a `whatsnew` entry in `0.24.0.txt` as well?

From a higher level, this seems like a corner case to me here: why would you want to pass in an empty object for `cond` for `.where` ? how is this not an error?

if you don’t have a conf then where doesn’t make sure > how is this not an error?

@jreback : That's what I was wondering too myself.  Perhaps a better error message is in order? # [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/21947?src=pr&el=h1) Report
> Merging [#21947](https://codecov.io/gh/pandas-dev/pandas/pull/21947?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/c6366f5c15acee213bad0d9f7a15ad69d4445a64?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/21947/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/21947?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #21947      +/-   ##
==========================================
+ Coverage   92.25%   92.25%   +<.01%     
==========================================
  Files         161      161              
  Lines       51169    51170       +1     
==========================================
+ Hits        47207    47208       +1     
  Misses       3962     3962
```

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

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/21947?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/generic.py](https://codecov.io/gh/pandas-dev/pandas/pull/21947/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ2VuZXJpYy5weQ==) | `96.81% <100%> (ø)` | :arrow_up: |

------

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

I wanted to write a test, but I did not find where were the unit tests for the 'where' function.

This is indeed a corner case, when both df and cond are empty. Example: 
```
import pandas as pd
data = [1]
df = pd.DataFrame(columns=['a'], data=data)
cond = df.applymap(lambda x: x > 0)
df.where(cond)  # Ok

data = []
df = pd.DataFrame(columns=['a'], data=data)
cond = df.applymap(lambda x: x > 0)
df.where(cond)  # Error
```

This kind of corner case do happen : 
- when you do unit testing 
- when your dataframe comes from real 'empty' data.

I had the same kind of corner case with df.duplicated in previous version of pandas.  yeah certainly could have a better error message (e.g. you can detect the .empty), but this should just be an error. the ``df`` empty is ok, but the cond cannot be empty (unless the df itself is empty).

 Yes, `cond` can be empty if and only if `df` is empty. 

But it is a bug to raise an error when they are both empty, no ?

As the bug is on `cond` dtype checking, I thought the easiest way to solve it was to avoid dtypes checking on empty dataframe (as it does not makes sense anyway).

One could also explicitly check for `df.empty`, but this would be weird as it already works when `cond` is empty with correct dtypes : 

```
data = []
df = pd.DataFrame(columns=['a'], data=data)
cond = df > 0 
df.where(cond)  # Ok
cond.dtypes  # bool
```
 Hello @pajachiet! Thanks for updating the PR.





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

##### Comment last updated on August 09, 2018 at 11:45 Hours UTC Hello,
I added a simple test as requested. 
I changed the commit two times because of pep8 mistake, then trying to fix the build, but it is still failing for a reason I do not understand (it does not seem related to the change).
 Could you help fixing it ? 
 closing as stale. if you'd like to continue, pls ping. I _believe_ the bug in the CI was not caused by changes in this PR.

This PR fixed a simple but real bug. I managed to fix it in another way for my client, so I only did this PR if it can improve pandas, especially in those edges cases that can be really annoying. 

I added a test, a whatsnew entry and answered your comments. 
Could you please manage to merge it ? 

Otherwise keep it close, it's too much an investment for such a minor improvment.

 @pajachiet : Do you want to finish this up?  I think it requires a rebase, that's all. > Otherwise keep it close, it's too much an investment for such a minor improvment.

well if it’s a bug then it will probably come up again

it’s always helpful to improve things  Let's take this for another spin. @jreback : Is there a reason why we can't attempt to merge this for `0.24.0` ?  I addressed the last comment (regarding the issue reference).  It's also rebased and green.  Did you have any other comments to add? Just saw your email regarding `0.24.0`.  That answers my question [above](https://github.com/pandas-dev/pandas/pull/21947#issuecomment-436126125). thanks! Many thanks ! :)