BUG/DEPR: deprecate Categorical take default behaviour + fix Series[categorical].take
State: closed

closes #20664

I might be unavailable for the next few hours, so I'm just putting this up here, even though it includes changes from https://github.com/pandas-dev/pandas/pull/20814 in the first commit. Once that is merged, this can be merged on top of master and it'll just have the categorical changes.

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

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/20841?src=pr&el=h1) Report
> Merging [#20841](https://codecov.io/gh/pandas-dev/pandas/pull/20841?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/563a6ad108a79b0192a25d51d743812a18e21b15?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/20841/graphs/tree.svg?token=eZ4WkYLtcO&src=pr&width=650&height=150)](https://codecov.io/gh/pandas-dev/pandas/pull/20841?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #20841      +/-   ##
==========================================
+ Coverage   91.77%   91.78%   +<.01%     
==========================================
  Files         153      153              
  Lines       49313    49324      +11     
==========================================
+ Hits        45259    45272      +13     
+ Misses       4054     4052       -2
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.17% <100%> (ø)` | :arrow_up: |
| #single | `41.91% <75%> (+0.02%)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/20841?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/arrays/categorical.py](https://codecov.io/gh/pandas-dev/pandas/pull/20841/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL2NhdGVnb3JpY2FsLnB5) | `95.61% <100%> (+0.04%)` | :arrow_up: |
| [pandas/core/series.py](https://codecov.io/gh/pandas-dev/pandas/pull/20841/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvc2VyaWVzLnB5) | `94.01% <100%> (+0.01%)` | :arrow_up: |
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/20841/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `84.59% <0%> (+0.2%)` | :arrow_up: |

------

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

OK, this is clean on top of master now.
Didn't see any warnings in the test logs. Should be good to go.

cc @jorisvandenbossche 
> Maybe you can add a whatsnew notice in the bug fixes as well for the Series.take

Was that ever in a released version? I thought it was just master where we broke that.
> Was that ever in a released version? I thought it was just master where we broke that.

No, it was a regression from 0.20 -> 0.21/22
Last failure was random. Fixed (properly this time) by d1c7e38.

Merging on green.
>  since u didn’t change any tests are there no warnings anywhere??

> Didn't see any warnings in the test logs. Should be good to go.

We apparently didn't test take directly.
This was passing before, so merging.