MAINT Use list and dict comprehension
State: closed

This uses list and dict comprehension in places where it doesn't hurt readability. It should be a bit faster and less verbose.


Labels:
name: Performance
description: Memory or execution speed performance
name: Code Style
description: Code style, linting, code_checks
name: Clean

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/23894?src=pr&el=h1) Report
> Merging [#23894](https://codecov.io/gh/pandas-dev/pandas/pull/23894?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/ee283faee006abf5b879d37fe17c2db4e0fa51fd?src=pr&el=desc) will **decrease** coverage by `<.01%`.
> The diff coverage is `100%`.

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

```diff
@@            Coverage Diff             @@
##           master   #23894      +/-   ##
==========================================
- Coverage   92.31%    92.3%   -0.01%     
==========================================
  Files         161      161              
  Lines       51471    51431      -40     
==========================================
- Hits        47515    47475      -40     
  Misses       3956     3956
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.7% <100%> (-0.01%)` | :arrow_down: |
| #single | `42.44% <35.29%> (ø)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/23894?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/groupby/ops.py](https://codecov.io/gh/pandas-dev/pandas/pull/23894/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ3JvdXBieS9vcHMucHk=) | `96.77% <100%> (-0.03%)` | :arrow_down: |
| [pandas/plotting/\_core.py](https://codecov.io/gh/pandas-dev/pandas/pull/23894/diff?src=pr&el=tree#diff-cGFuZGFzL3Bsb3R0aW5nL19jb3JlLnB5) | `83.58% <100%> (-0.05%)` | :arrow_down: |
| [pandas/core/config.py](https://codecov.io/gh/pandas-dev/pandas/pull/23894/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY29uZmlnLnB5) | `87.04% <100%> (-0.13%)` | :arrow_down: |
| [pandas/core/dtypes/concat.py](https://codecov.io/gh/pandas-dev/pandas/pull/23894/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZHR5cGVzL2NvbmNhdC5weQ==) | `96.63% <100%> (-0.04%)` | :arrow_down: |
| [pandas/core/computation/align.py](https://codecov.io/gh/pandas-dev/pandas/pull/23894/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY29tcHV0YXRpb24vYWxpZ24ucHk=) | `97.84% <100%> (-0.05%)` | :arrow_down: |
| [pandas/core/sparse/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/23894/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvc3BhcnNlL2ZyYW1lLnB5) | `94.83% <100%> (-0.03%)` | :arrow_down: |
| [pandas/io/formats/style.py](https://codecov.io/gh/pandas-dev/pandas/pull/23894/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2Zvcm1hdHMvc3R5bGUucHk=) | `96.67% <100%> (-0.03%)` | :arrow_down: |
| [pandas/core/internals/blocks.py](https://codecov.io/gh/pandas-dev/pandas/pull/23894/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW50ZXJuYWxzL2Jsb2Nrcy5weQ==) | `93.69% <100%> (-0.02%)` | :arrow_down: |
| [pandas/core/panel.py](https://codecov.io/gh/pandas-dev/pandas/pull/23894/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvcGFuZWwucHk=) | `97.91% <100%> (-0.02%)` | :arrow_down: |
| [pandas/io/formats/printing.py](https://codecov.io/gh/pandas-dev/pandas/pull/23894/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2Zvcm1hdHMvcHJpbnRpbmcucHk=) | `93.01% <100%> (-0.08%)` | :arrow_down: |
| ... and [4 more](https://codecov.io/gh/pandas-dev/pandas/pull/23894/diff?src=pr&el=tree-more) | |

------

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

can you merge master, ping on green.
Hello @rth! Thanks for updating the PR.

 - There are no PEP8 issues in the file [`pandas/core/computation/align.py`](https://github.com/rth/pandas/blob/5a7fa8d82b46bdcb848e80c4f22ba9aa9ccd6f43/pandas/core/computation/align.py) !

 - There are no PEP8 issues in the file [`pandas/core/config.py`](https://github.com/rth/pandas/blob/5a7fa8d82b46bdcb848e80c4f22ba9aa9ccd6f43/pandas/core/config.py) !

 - There are no PEP8 issues in the file [`pandas/core/dtypes/concat.py`](https://github.com/rth/pandas/blob/5a7fa8d82b46bdcb848e80c4f22ba9aa9ccd6f43/pandas/core/dtypes/concat.py) !

 - There are no PEP8 issues in the file [`pandas/core/frame.py`](https://github.com/rth/pandas/blob/5a7fa8d82b46bdcb848e80c4f22ba9aa9ccd6f43/pandas/core/frame.py) !

 - There are no PEP8 issues in the file [`pandas/core/groupby/ops.py`](https://github.com/rth/pandas/blob/5a7fa8d82b46bdcb848e80c4f22ba9aa9ccd6f43/pandas/core/groupby/ops.py) !

 - There are no PEP8 issues in the file [`pandas/core/internals/blocks.py`](https://github.com/rth/pandas/blob/5a7fa8d82b46bdcb848e80c4f22ba9aa9ccd6f43/pandas/core/internals/blocks.py) !

 - There are no PEP8 issues in the file [`pandas/core/panel.py`](https://github.com/rth/pandas/blob/5a7fa8d82b46bdcb848e80c4f22ba9aa9ccd6f43/pandas/core/panel.py) !

 - There are no PEP8 issues in the file [`pandas/core/reshape/melt.py`](https://github.com/rth/pandas/blob/5a7fa8d82b46bdcb848e80c4f22ba9aa9ccd6f43/pandas/core/reshape/melt.py) !

 - There are no PEP8 issues in the file [`pandas/core/sparse/frame.py`](https://github.com/rth/pandas/blob/5a7fa8d82b46bdcb848e80c4f22ba9aa9ccd6f43/pandas/core/sparse/frame.py) !

 - There are no PEP8 issues in the file [`pandas/core/window.py`](https://github.com/rth/pandas/blob/5a7fa8d82b46bdcb848e80c4f22ba9aa9ccd6f43/pandas/core/window.py) !

 - There are no PEP8 issues in the file [`pandas/io/excel.py`](https://github.com/rth/pandas/blob/5a7fa8d82b46bdcb848e80c4f22ba9aa9ccd6f43/pandas/io/excel.py) !

 - There are no PEP8 issues in the file [`pandas/io/formats/html.py`](https://github.com/rth/pandas/blob/5a7fa8d82b46bdcb848e80c4f22ba9aa9ccd6f43/pandas/io/formats/html.py) !

 - There are no PEP8 issues in the file [`pandas/io/formats/printing.py`](https://github.com/rth/pandas/blob/5a7fa8d82b46bdcb848e80c4f22ba9aa9ccd6f43/pandas/io/formats/printing.py) !

 - There are no PEP8 issues in the file [`pandas/io/formats/style.py`](https://github.com/rth/pandas/blob/5a7fa8d82b46bdcb848e80c4f22ba9aa9ccd6f43/pandas/io/formats/style.py) !

 - There are no PEP8 issues in the file [`pandas/io/sas/sas_xport.py`](https://github.com/rth/pandas/blob/5a7fa8d82b46bdcb848e80c4f22ba9aa9ccd6f43/pandas/io/sas/sas_xport.py) !

 - There are no PEP8 issues in the file [`pandas/io/stata.py`](https://github.com/rth/pandas/blob/5a7fa8d82b46bdcb848e80c4f22ba9aa9ccd6f43/pandas/io/stata.py) !

 - There are no PEP8 issues in the file [`pandas/plotting/_core.py`](https://github.com/rth/pandas/blob/5a7fa8d82b46bdcb848e80c4f22ba9aa9ccd6f43/pandas/plotting/_core.py) !

 - There are no PEP8 issues in the file [`pandas/tests/frame/test_axis_select_reindex.py`](https://github.com/rth/pandas/blob/5a7fa8d82b46bdcb848e80c4f22ba9aa9ccd6f43/pandas/tests/frame/test_axis_select_reindex.py) !

 - There are no PEP8 issues in the file [`pandas/tests/frame/test_indexing.py`](https://github.com/rth/pandas/blob/5a7fa8d82b46bdcb848e80c4f22ba9aa9ccd6f43/pandas/tests/frame/test_indexing.py) !

 - There are no PEP8 issues in the file [`pandas/tests/frame/test_replace.py`](https://github.com/rth/pandas/blob/5a7fa8d82b46bdcb848e80c4f22ba9aa9ccd6f43/pandas/tests/frame/test_replace.py) !

 - There are no PEP8 issues in the file [`pandas/tests/generic/test_generic.py`](https://github.com/rth/pandas/blob/5a7fa8d82b46bdcb848e80c4f22ba9aa9ccd6f43/pandas/tests/generic/test_generic.py) !

 - There are no PEP8 issues in the file [`pandas/tests/groupby/aggregate/test_cython.py`](https://github.com/rth/pandas/blob/5a7fa8d82b46bdcb848e80c4f22ba9aa9ccd6f43/pandas/tests/groupby/aggregate/test_cython.py) !

 - There are no PEP8 issues in the file [`pandas/tests/groupby/test_groupby.py`](https://github.com/rth/pandas/blob/5a7fa8d82b46bdcb848e80c4f22ba9aa9ccd6f43/pandas/tests/groupby/test_groupby.py) !

 - There are no PEP8 issues in the file [`pandas/tests/groupby/test_grouping.py`](https://github.com/rth/pandas/blob/5a7fa8d82b46bdcb848e80c4f22ba9aa9ccd6f43/pandas/tests/groupby/test_grouping.py) !

 - There are no PEP8 issues in the file [`pandas/tests/groupby/test_rank.py`](https://github.com/rth/pandas/blob/5a7fa8d82b46bdcb848e80c4f22ba9aa9ccd6f43/pandas/tests/groupby/test_rank.py) !

 - There are no PEP8 issues in the file [`pandas/tests/indexes/multi/test_constructor.py`](https://github.com/rth/pandas/blob/5a7fa8d82b46bdcb848e80c4f22ba9aa9ccd6f43/pandas/tests/indexes/multi/test_constructor.py) !

 - There are no PEP8 issues in the file [`pandas/tests/sparse/frame/test_frame.py`](https://github.com/rth/pandas/blob/5a7fa8d82b46bdcb848e80c4f22ba9aa9ccd6f43/pandas/tests/sparse/frame/test_frame.py) !

 - There are no PEP8 issues in the file [`pandas/tests/sparse/series/test_series.py`](https://github.com/rth/pandas/blob/5a7fa8d82b46bdcb848e80c4f22ba9aa9ccd6f43/pandas/tests/sparse/series/test_series.py) !

 - There are no PEP8 issues in the file [`pandas/tests/test_resample.py`](https://github.com/rth/pandas/blob/5a7fa8d82b46bdcb848e80c4f22ba9aa9ccd6f43/pandas/tests/test_resample.py) !


Thanks @datapythonista ! Addressed your comment.

@jreback Merged master in and CI is green.
thanks @rth