is_bool_dtype for ExtensionArrays
State: closed

Closes #22326
Closes #22665 

Two commits:  https://github.com/pandas-dev/pandas/commit/fe3500248dec1b21469e94e054f636dc7707fae0 partially implements an Arrow-backed ExtensionArray. We need this as we don't currently have any boolean-values EAs.

https://github.com/pandas-dev/pandas/commit/04029ac94d1e53fbec18264beabccb49c1e002b1 has the fix for the bug.

Labels:
name: Indexing
description: Related to indexing on series/frames, not to indexes themselves
name: Dtype Conversions
description: Unexpected or buggy dtype conversions
name: ExtensionArray
description: Extending pandas with custom dtypes or arrays.

Comments:
Hello @TomAugspurger! Thanks for updating the PR.

 - In the file [`pandas/core/common.py`](https://github.com/TomAugspurger/pandas/blob/29b1370aea369645b11c6f76544def634c9c30b1/pandas/core/common.py), following                are the PEP8 issues :
> [Line 128:13](https://github.com/TomAugspurger/pandas/blob/29b1370aea369645b11c6f76544def634c9c30b1/pandas/core/common.py#L128): [W504](https://duckduckgo.com/?q=pep8%20W504) line break after binary operator


 - There are no PEP8 issues in the file [`pandas/core/dtypes/base.py`](https://github.com/TomAugspurger/pandas/blob/29b1370aea369645b11c6f76544def634c9c30b1/pandas/core/dtypes/base.py) !

 - There are no PEP8 issues in the file [`pandas/core/dtypes/common.py`](https://github.com/TomAugspurger/pandas/blob/29b1370aea369645b11c6f76544def634c9c30b1/pandas/core/dtypes/common.py) !

 - There are no PEP8 issues in the file [`pandas/core/dtypes/dtypes.py`](https://github.com/TomAugspurger/pandas/blob/29b1370aea369645b11c6f76544def634c9c30b1/pandas/core/dtypes/dtypes.py) !

 - There are no PEP8 issues in the file [`pandas/tests/arrays/categorical/test_indexing.py`](https://github.com/TomAugspurger/pandas/blob/29b1370aea369645b11c6f76544def634c9c30b1/pandas/tests/arrays/categorical/test_indexing.py) !

 - There are no PEP8 issues in the file [`pandas/tests/dtypes/test_dtypes.py`](https://github.com/TomAugspurger/pandas/blob/29b1370aea369645b11c6f76544def634c9c30b1/pandas/tests/dtypes/test_dtypes.py) !

 - There are no PEP8 issues in the file [`pandas/tests/extension/arrow/bool.py`](https://github.com/TomAugspurger/pandas/blob/29b1370aea369645b11c6f76544def634c9c30b1/pandas/tests/extension/arrow/bool.py) !

 - There are no PEP8 issues in the file [`pandas/tests/extension/arrow/test_bool.py`](https://github.com/TomAugspurger/pandas/blob/29b1370aea369645b11c6f76544def634c9c30b1/pandas/tests/extension/arrow/test_bool.py) !



##### Comment last updated on September 20, 2018 at 14:00 Hours UTC
The bot is wrong, right?
Looks like there's an inconsistency in `is_bool_indexer` with how `NaN` is handled.

Returns `True` for a `Categorical` with `NaN`:
```python
In [2]: cat = pd.Categorical([True, False, np.nan])

In [3]: cat
Out[3]:
[True, False, NaN]
Categories (2, object): [False, True]

In [4]: pd.core.common.is_bool_indexer(cat)
Out[4]: True
```

Raises for an `Index` with `NaN`:
```python
In [5]: idx = pd.Index([True, False, np.nan])

In [6]: idx
Out[6]: Index([True, False, nan], dtype='object')

In [7]: pd.core.common.is_bool_indexer(idx)
---------------------------------------------------------------------------
ValueError: cannot index with vector containing NA / NaN values
```

Also, it doesn't look like we have any existing tests for `is_bool_indexer`?  Might be nice to have some tests around it, but can probably create a separate issue/pr for that.
Hmm, that's unfortunate... Ideally we could avoid scanning the values but maybe that 's not possible here.
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/22667?src=pr&el=h1) Report
> Merging [#22667](https://codecov.io/gh/pandas-dev/pandas/pull/22667?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/117d0b1011c090b4658b0e84c2b572ee713e21de?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/22667/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/22667?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #22667      +/-   ##
==========================================
+ Coverage   92.17%   92.18%   +<.01%     
==========================================
  Files         169      169              
  Lines       50780    50794      +14     
==========================================
+ Hits        46809    46823      +14     
  Misses       3971     3971
```

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

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/22667?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/dtypes/base.py](https://codecov.io/gh/pandas-dev/pandas/pull/22667/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZHR5cGVzL2Jhc2UucHk=) | `100% <100%> (ø)` | :arrow_up: |
| [pandas/core/dtypes/dtypes.py](https://codecov.io/gh/pandas-dev/pandas/pull/22667/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZHR5cGVzL2R0eXBlcy5weQ==) | `96.11% <100%> (+0.03%)` | :arrow_up: |
| [pandas/core/dtypes/common.py](https://codecov.io/gh/pandas-dev/pandas/pull/22667/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZHR5cGVzL2NvbW1vbi5weQ==) | `95.02% <100%> (+0.08%)` | :arrow_up: |
| [pandas/core/common.py](https://codecov.io/gh/pandas-dev/pandas/pull/22667/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY29tbW9uLnB5) | `97.44% <100%> (+0.05%)` | :arrow_up: |
| [pandas/core/arrays/categorical.py](https://codecov.io/gh/pandas-dev/pandas/pull/22667/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL2NhdGVnb3JpY2FsLnB5) | `95.74% <0%> (-0.02%)` | :arrow_down: |

------

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

Yes, fixed.
@jreback changed `.kind` to use a new `_is_boolean` property (False by default)
All green.
Going to fix the whatsnew conflict on merge.

Speaking of which... are we going to wait around for circleci to catch up today, or are people OK with merging smallish PRs that haven't finished there?
I would go ahead and merge