DOC: sub-section on boolean Index array changes
State: closed

closes #17740


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

Comments:
cc @jorisvandenbossche 
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17803?src=pr&el=h1) Report
> Merging [#17803](https://codecov.io/gh/pandas-dev/pandas/pull/17803?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/5653fe41b41fa1b60f3a7edf88a47f29ec7868ee?src=pr&el=desc) will **decrease** coverage by `0.01%`.
> The diff coverage is `n/a`.

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

```diff
@@            Coverage Diff             @@
##           master   #17803      +/-   ##
==========================================
- Coverage   91.24%   91.22%   -0.02%     
==========================================
  Files         163      163              
  Lines       49971    49971              
==========================================
- Hits        45597    45588       -9     
- Misses       4374     4383       +9
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.03% <ø> (ø)` | :arrow_up: |
| #single | `40.24% <ø> (-0.07%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/17803?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/17803?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/17803?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.74% <0%> (-0.1%)` | :arrow_down: |

------

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

# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17803?src=pr&el=h1) Report
> Merging [#17803](https://codecov.io/gh/pandas-dev/pandas/pull/17803?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/3b4121b5fca88a84bcc9dba56af568c8a2f901c0?src=pr&el=desc) will **decrease** coverage by `0.02%`.
> The diff coverage is `n/a`.

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

```diff
@@            Coverage Diff             @@
##           master   #17803      +/-   ##
==========================================
- Coverage   91.25%   91.23%   -0.03%     
==========================================
  Files         163      163              
  Lines       49971    49971              
==========================================
- Hits        45599    45589      -10     
- Misses       4372     4382      +10
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.03% <ø> (-0.01%)` | :arrow_down: |
| #single | `40.24% <ø> (-0.07%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/17803?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/17803?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/17803?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.74% <0%> (-0.1%)` | :arrow_down: |
| [pandas/core/indexes/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/17803?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZXMucHk=) | `95.48% <0%> (-0.1%)` | :arrow_down: |

------

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

 > Iwould also add that previously for non-boolean and non-numeric indices, it would raise a KeyError (since the True / False were regarded as labels), and not will do boolean selection.

not following, what is the example?
So previously Index with True / False values were always regarded as *labels*, not as a boolean mask. Which resulted in a KeyError for non-numeric indices or actual label-based indexing for numeric/boolean index (the fact that it interpreted True/False as 1/0 is the bug that was been fixed in an earlier PR regarding drop, but the general thing (your recent PR) that boolean index is not seen as labels is the API change you describe in the PR here).

So previous:

```
In [38]: s = pd.Series([1,2,3], index=['a', 'b', 'c'])

In [39]: s.loc[pd.Index([True, False, True])]
...
KeyError: "None of [Index([True, False, True], dtype='object')] are in the [index]"

In [42]: s = pd.Series([1,2,3])

In [43]: s.loc[pd.Index([True, False, True])]
Out[43]: 
1    2
0    1
1    2
dtype: int64
```

Now:

```
In [4]: s = pd.Series([1,2,3], index=['a', 'b', 'c'])

In [5]: s.loc[pd.Index([True, False, True])]
Out[5]: 
a    1
c    3
dtype: int64

In [6]: s = pd.Series([1,2,3])

In [7]: s.loc[pd.Index([True, False, True])]
Out[7]: 
0    1
2    3
dtype: int64
```

(but it is not perse necessary to add all those example, for me just adding it in the text is fine as well. I suspect that not many people deliberately will have used a boolean index to index a non-numeric index and explicitly catched the KeyError ... The main change is when you actually had a boolean index in the object you are indexing (i.e. the case for which you already have an example))
ic, ok will add that as well.