CLN: Flake8 E741
State: closed

- [x] towards #22122  ( test files still remaining for E741)
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`

Import optimiser, makes things alphabetical and also removes unused eg, `Float64Index`, in `packers.py`. Do people prefer this or not?

Labels:
name: CI
description: Continuous Integration
name: Code Style
description: Code style, linting, code_checks

Comments:
Hello @alimcmaster1! Thanks for submitting the PR.

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

 - There are no PEP8 issues in the file [`pandas/core/indexes/range.py`](https://github.com/alimcmaster1/pandas/blob/2ca0f3969b720df043ede51f774072d7f7985c04/pandas/core/indexes/range.py) !

 - There are no PEP8 issues in the file [`pandas/core/indexing.py`](https://github.com/alimcmaster1/pandas/blob/2ca0f3969b720df043ede51f774072d7f7985c04/pandas/core/indexing.py) !

 - There are no PEP8 issues in the file [`pandas/io/packers.py`](https://github.com/alimcmaster1/pandas/blob/2ca0f3969b720df043ede51f774072d7f7985c04/pandas/io/packers.py) !

 - There are no PEP8 issues in the file [`pandas/io/pytables.py`](https://github.com/alimcmaster1/pandas/blob/2ca0f3969b720df043ede51f774072d7f7985c04/pandas/io/pytables.py) !


I'm personally happy with this. @jreback ?

I'd probably use `length` instead of `l` or `ln`, but other than that, the changes look all right.

Once #22863 is merged, it'll be good to stop ignoring E402 and E741 from the linting, and see if there is much more being reported.
Thanks for taking a look @datapythonista updated as per your comments. ln -> length is clearer to me too :)
In general, I'm in favor of sorting imports, but we shouldn't be doing manually and it should be linted, else we'll be doing it again in a few months.

I'd recommend getting a consensus on an [isort](https://isort.readthedocs.io/en/stable/) configuration that we all like, and then adding a lint check to ensure that the sort order is respected.

```
isort --recursive --check-only .
```

For dask-ml we use

```
[isort]
multi_line_output=3
include_trailing_comma=True
force_grid_wrap=0
combine_as_imports=True
line_length=88
```
Thanks @TomAugspurger totally agree, let me create an issue and see if we can decide on config set up.
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/22913?src=pr&el=h1) Report
> :exclamation: No coverage uploaded for pull request base (`master@e510b1a`). [Click here to learn what that means](https://docs.codecov.io/docs/error-reference#section-missing-base-commit).
> The diff coverage is `95.48%`.

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

```diff
@@            Coverage Diff            @@
##             master   #22913   +/-   ##
=========================================
  Coverage          ?   92.19%           
=========================================
  Files             ?      169           
  Lines             ?    50879           
  Branches          ?        0           
=========================================
  Hits              ?    46910           
  Misses            ?     3969           
  Partials          ?        0
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.61% <86.45%> (?)` | |
| #single | `42.32% <89.03%> (?)` | |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/22913?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/22913/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.2% <100%> (ø)` | |
| [pandas/core/indexing.py](https://codecov.io/gh/pandas-dev/pandas/pull/22913/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhpbmcucHk=) | `93.87% <100%> (ø)` | |
| [pandas/core/indexes/range.py](https://codecov.io/gh/pandas-dev/pandas/pull/22913/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9yYW5nZS5weQ==) | `95.73% <100%> (ø)` | |
| [pandas/io/packers.py](https://codecov.io/gh/pandas-dev/pandas/pull/22913/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL3BhY2tlcnMucHk=) | `88.04% <92.3%> (ø)` | |
| [pandas/io/pytables.py](https://codecov.io/gh/pandas-dev/pandas/pull/22913/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL3B5dGFibGVzLnB5) | `92.44% <93.61%> (ø)` | |

------

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

Thanks @jbrockmendel for the review, ive updated as per your comments mind confirming this looks good?
I think all my nitpickings have been addressed.
If you want to add checking for specific files for certain warnings, then add a line to lint.sh to do this. 
thanks @alimcmaster1 

just want point out that we need a good way of validating import ordering before we wholesale fix it.
thanks @jreback for the review. Ive raised an issue for this here #23048 , to clarify: by validating import ordering are you referring to the fact we need to group by dependency structure like @jbrockmendel is referring to here? Or am I missing something here?