CLN: Remove PY2/PY3 flags from pandas.compat
State: closed

- [X] xref #25725
- [X] tests passed
- [X] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`

Labels:
name: Clean

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/26047?src=pr&el=h1) Report
> Merging [#26047](https://codecov.io/gh/pandas-dev/pandas/pull/26047?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/e02ec8f89a743cc56a79e660b7be850448d15f61?src=pr&el=desc) will **increase** coverage by `0.04%`.
> The diff coverage is `97.14%`.

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

```diff
@@            Coverage Diff             @@
##           master   #26047      +/-   ##
==========================================
+ Coverage    91.9%   91.94%   +0.04%     
==========================================
  Files         175      175              
  Lines       52485    52421      -64     
==========================================
- Hits        48235    48201      -34     
+ Misses       4250     4220      -30
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.5% <97.14%> (+0.05%)` | :arrow_up: |
| #single | `40.76% <62.85%> (-0.12%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/26047?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/arrays/timedeltas.py](https://codecov.io/gh/pandas-dev/pandas/pull/26047/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL3RpbWVkZWx0YXMucHk=) | `88.58% <ø> (+0.31%)` | :arrow_up: |
| [pandas/core/indexes/timedeltas.py](https://codecov.io/gh/pandas-dev/pandas/pull/26047/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy90aW1lZGVsdGFzLnB5) | `90.73% <ø> (+0.45%)` | :arrow_up: |
| [pandas/core/ops.py](https://codecov.io/gh/pandas-dev/pandas/pull/26047/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvb3BzLnB5) | `91.82% <ø> (+0.09%)` | :arrow_up: |
| [pandas/core/arrays/sparse.py](https://codecov.io/gh/pandas-dev/pandas/pull/26047/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL3NwYXJzZS5weQ==) | `92.3% <ø> (+0.1%)` | :arrow_up: |
| [pandas/core/indexes/base.py](https://codecov.io/gh/pandas-dev/pandas/pull/26047/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9iYXNlLnB5) | `96.99% <ø> (+0.2%)` | :arrow_up: |
| [pandas/core/indexes/range.py](https://codecov.io/gh/pandas-dev/pandas/pull/26047/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9yYW5nZS5weQ==) | `97.97% <ø> (+0.55%)` | :arrow_up: |
| [pandas/compat/\_\_init\_\_.py](https://codecov.io/gh/pandas-dev/pandas/pull/26047/diff?src=pr&el=tree#diff-cGFuZGFzL2NvbXBhdC9fX2luaXRfXy5weQ==) | `92.3% <100%> (+14.66%)` | :arrow_up: |
| [pandas/core/strings.py](https://codecov.io/gh/pandas-dev/pandas/pull/26047/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvc3RyaW5ncy5weQ==) | `98.86% <100%> (+0.26%)` | :arrow_up: |
| [pandas/core/dtypes/dtypes.py](https://codecov.io/gh/pandas-dev/pandas/pull/26047/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZHR5cGVzL2R0eXBlcy5weQ==) | `96.32% <100%> (+0.21%)` | :arrow_up: |
| [pandas/core/arrays/base.py](https://codecov.io/gh/pandas-dev/pandas/pull/26047/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL2Jhc2UucHk=) | `99.43% <100%> (+1.09%)` | :arrow_up: |
| ... and [9 more](https://codecov.io/gh/pandas-dev/pandas/pull/26047/diff?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/26047?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/26047?src=pr&el=footer). Last update [e02ec8f...31e4535](https://codecov.io/gh/pandas-dev/pandas/pull/26047?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/26047?src=pr&el=h1) Report
> Merging [#26047](https://codecov.io/gh/pandas-dev/pandas/pull/26047?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/e02ec8f89a743cc56a79e660b7be850448d15f61?src=pr&el=desc) will **increase** coverage by `0.04%`.
> The diff coverage is `97.14%`.

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

```diff
@@            Coverage Diff             @@
##           master   #26047      +/-   ##
==========================================
+ Coverage    91.9%   91.94%   +0.04%     
==========================================
  Files         175      175              
  Lines       52485    52420      -65     
==========================================
- Hits        48235    48200      -35     
+ Misses       4250     4220      -30
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.5% <97.14%> (+0.05%)` | :arrow_up: |
| #single | `40.76% <62.85%> (-0.13%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/26047?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/arrays/timedeltas.py](https://codecov.io/gh/pandas-dev/pandas/pull/26047/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL3RpbWVkZWx0YXMucHk=) | `88.58% <ø> (+0.31%)` | :arrow_up: |
| [pandas/core/indexes/timedeltas.py](https://codecov.io/gh/pandas-dev/pandas/pull/26047/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy90aW1lZGVsdGFzLnB5) | `90.73% <ø> (+0.45%)` | :arrow_up: |
| [pandas/core/ops.py](https://codecov.io/gh/pandas-dev/pandas/pull/26047/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvb3BzLnB5) | `91.82% <ø> (+0.09%)` | :arrow_up: |
| [pandas/core/arrays/sparse.py](https://codecov.io/gh/pandas-dev/pandas/pull/26047/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL3NwYXJzZS5weQ==) | `92.3% <ø> (+0.1%)` | :arrow_up: |
| [pandas/core/indexes/base.py](https://codecov.io/gh/pandas-dev/pandas/pull/26047/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9iYXNlLnB5) | `96.99% <ø> (+0.2%)` | :arrow_up: |
| [pandas/core/indexes/range.py](https://codecov.io/gh/pandas-dev/pandas/pull/26047/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9yYW5nZS5weQ==) | `97.97% <ø> (+0.55%)` | :arrow_up: |
| [pandas/compat/\_\_init\_\_.py](https://codecov.io/gh/pandas-dev/pandas/pull/26047/diff?src=pr&el=tree#diff-cGFuZGFzL2NvbXBhdC9fX2luaXRfXy5weQ==) | `92.3% <100%> (+14.66%)` | :arrow_up: |
| [pandas/core/strings.py](https://codecov.io/gh/pandas-dev/pandas/pull/26047/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvc3RyaW5ncy5weQ==) | `98.86% <100%> (+0.26%)` | :arrow_up: |
| [pandas/core/dtypes/dtypes.py](https://codecov.io/gh/pandas-dev/pandas/pull/26047/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZHR5cGVzL2R0eXBlcy5weQ==) | `96.32% <100%> (+0.21%)` | :arrow_up: |
| [pandas/core/arrays/base.py](https://codecov.io/gh/pandas-dev/pandas/pull/26047/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL2Jhc2UucHk=) | `99.43% <100%> (+1.09%)` | :arrow_up: |
| ... and [9 more](https://codecov.io/gh/pandas-dev/pandas/pull/26047/diff?src=pr&el=tree-more) | |

------

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

Does this technically close #25725? Some of the functions in `compat/__init__.py` could still be cleaned up, but I think there's no more PY2 compat after this PR.
@mroeschke : I think it does. 🎉  I've updated the PR description accordingly.

@jschendel : Could you update the module docstring to indicate this no longer is compat for PY2?
> Does this technically close #25725? 

There are still a few small odds and ends left to address.  Will detail them in the main issue later on today.

> Could you update the module docstring to indicate this no longer is compat for PY2?

Sure, will get that done later today too.
merge away
Thanks @jschendel