REF: SparseArray imports
State: closed

arrays/sparse.py was doing an `import pandas as pd`, which is prone to cause circular imports. I've eliminated that import and updated the namespaces appropriately (NaT, isna, algos.unique / factorize).

Also updated `setup.cfg` to check the import order in `arrays/sparse.py`.

Labels:
name: Refactor
description: Internal refactoring of code
name: Sparse
description: Sparse Data Type

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

 - There are no PEP8 issues in the file [`pandas/core/arrays/sparse.py`](https://github.com/TomAugspurger/pandas/blob/a6b0613138121684dcdc809e12e775c0ac2d3579/pandas/core/arrays/sparse.py) !

 - There are no PEP8 issues in the file [`pandas/core/series.py`](https://github.com/TomAugspurger/pandas/blob/a6b0613138121684dcdc809e12e775c0ac2d3579/pandas/core/series.py) !


LGTM -  thanks for cleaning up the imports using isort too :)
I think if you remove one of the newlines after `from pandas.errors import PerformanceWarning` in sparse.py that should fix the isort failure on CI :)
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/23329?src=pr&el=h1) Report
> Merging [#23329](https://codecov.io/gh/pandas-dev/pandas/pull/23329?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/437f31cb609372f465aaa853bf4b2299a9550716?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `96%`.

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

```diff
@@           Coverage Diff           @@
##           master   #23329   +/-   ##
=======================================
  Coverage   92.22%   92.22%           
=======================================
  Files         169      169           
  Lines       51258    51258           
=======================================
  Hits        47274    47274           
  Misses       3984     3984
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.66% <96%> (ø)` | :arrow_up: |
| #single | `42.23% <64%> (-0.01%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/23329?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/series.py](https://codecov.io/gh/pandas-dev/pandas/pull/23329/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvc2VyaWVzLnB5) | `93.91% <100%> (-0.01%)` | :arrow_down: |
| [pandas/core/arrays/sparse.py](https://codecov.io/gh/pandas-dev/pandas/pull/23329/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL3NwYXJzZS5weQ==) | `91.84% <95.83%> (ø)` | :arrow_up: |
| [pandas/core/arrays/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/23329/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL2RhdGV0aW1lcy5weQ==) | `97.46% <0%> (ø)` | :arrow_up: |

------

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

Thanks.

Merging tonight, since this is a straight refactor, and I have another PR building on top if it.
pls merge master ping on green.
CircleCI seems to be ~10 hours behind. OK to cancel those, since we're dropping (most) of them anyway? I'll be free to clean things up this afternoon if we accidentally break anything.
sure