Sanitize imports so tools.datetimes, tools.timedeltas, tools.numeric
State: closed

are robust to changes in import order.

- [ ] closes #xxxx
- [ ] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry


Labels:
name: Clean

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

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

```diff
@@            Coverage Diff             @@
##           master   #17208      +/-   ##
==========================================
- Coverage   91.03%      91%   -0.03%     
==========================================
  Files         162      162              
  Lines       49511    49510       -1     
==========================================
- Hits        45070    45059      -11     
- Misses       4441     4451      +10
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.79% <83.33%> (-0.01%)` | :arrow_down: |
| #single | `40.26% <0%> (-0.07%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/17208?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/tools/timedeltas.py](https://codecov.io/gh/pandas-dev/pandas/pull/17208?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvdG9vbHMvdGltZWRlbHRhcy5weQ==) | `98.3% <100%> (-0.03%)` | :arrow_down: |
| [pandas/core/tools/numeric.py](https://codecov.io/gh/pandas-dev/pandas/pull/17208?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvdG9vbHMvbnVtZXJpYy5weQ==) | `100% <100%> (ø)` | :arrow_up: |
| [pandas/core/tools/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/17208?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvdG9vbHMvZGF0ZXRpbWVzLnB5) | `66.57% <50%> (-0.28%)` | :arrow_down: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/17208?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/17208?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.71% <0%> (-0.1%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17208?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/17208?src=pr&el=footer). Last update [073c145...d79782d](https://codecov.io/gh/pandas-dev/pandas/pull/17208?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/17208?src=pr&el=h1) Report
> Merging [#17208](https://codecov.io/gh/pandas-dev/pandas/pull/17208?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/073c14544436d95969258928e2554cb2fc093c99?src=pr&el=desc) will **decrease** coverage by `0.02%`.
> The diff coverage is `83.33%`.

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

```diff
@@            Coverage Diff             @@
##           master   #17208      +/-   ##
==========================================
- Coverage   91.03%      91%   -0.03%     
==========================================
  Files         162      162              
  Lines       49511    49510       -1     
==========================================
- Hits        45070    45059      -11     
- Misses       4441     4451      +10
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.79% <83.33%> (-0.01%)` | :arrow_down: |
| #single | `40.26% <0%> (-0.07%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/17208?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/tools/numeric.py](https://codecov.io/gh/pandas-dev/pandas/pull/17208?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvdG9vbHMvbnVtZXJpYy5weQ==) | `100% <100%> (ø)` | :arrow_up: |
| [pandas/core/tools/timedeltas.py](https://codecov.io/gh/pandas-dev/pandas/pull/17208?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvdG9vbHMvdGltZWRlbHRhcy5weQ==) | `98.3% <100%> (-0.03%)` | :arrow_down: |
| [pandas/core/tools/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/17208?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvdG9vbHMvZGF0ZXRpbWVzLnB5) | `66.57% <50%> (-0.28%)` | :arrow_down: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/17208?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/17208?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.71% <0%> (-0.1%)` | :arrow_down: |

------

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

Is this actually the way we want to go? Eg the plotting modules should be a rather independent module from core, so what's the problem with importing from there? 
Replacing all occurrences of Index to ABCIndexClass and similar, IMO makes the code less readable and more difficult for new contributors.
> so what's the problem with importing from there?

Until recently there were issues with circular imports from `plotting`.  This started out as an attempt to preemptively untangle any potential similar issues, but lost focus and got away from me.  You're right this is not a good use of time.  My bad.
> Is this actually the way we want to go? Eg the plotting modules should be a rather independent module from core, so what's the problem with importing from there?
Replacing all occurrences of Index to ABCIndexClass and similar, IMO makes the code less readable and more difficult for new contributors.

yes. this is must easier to handle imports, and only when actual construction is need do you actually import Series/DataFrame. 

this already exists in most of the codebase.