CLN: typing/mypy cleanup: Small fixes to make stubgen happy
State: closed

No code changes, just moved a few comments, and fixed a few broken types.

This patch allows stubgen to run over the pandas codebase without generating errors

Labels:
name: Clean

Comments:
Hello @Naddiseo! Thanks for updating this PR. We checked the lines you've touched for [PEP 8](https://www.python.org/dev/peps/pep-0008) issues, and found:









There are currently no PEP 8 issues detected in this Pull Request. Cheers! :beers: 

##### Comment last updated at 2019-03-06 21:09:56 UTC
Hmm thanks. So our next minor release drops support for Py27 so maybe time to convert these into 3.X compatible hints? @jreback @TomAugspurger 
We'll need to talk a bit about that (maybe on the call tomorrow). Someone will need to look into whether we're using things from typing that are 3.6+.
Cool - makes sense as a conversation piece tomorrow. The only one that I *think* would be very useful from 3.6 would be the Collections type, though I admittedly don't have a ton of experience with hints. 

In any case I still think those in this PR should be converted to the 3.X syntax
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/25576?src=pr&el=h1) Report
> Merging [#25576](https://codecov.io/gh/pandas-dev/pandas/pull/25576?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/3e652ac565e054b763ccbe23006c02704f6cd1b1?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `n/a`.

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

```diff
@@           Coverage Diff           @@
##           master   #25576   +/-   ##
=======================================
  Coverage   91.26%   91.26%           
=======================================
  Files         173      173           
  Lines       52966    52966           
=======================================
  Hits        48337    48337           
  Misses       4629     4629
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.83% <ø> (ø)` | :arrow_up: |
| #single | `41.71% <ø> (ø)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/25576?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/groupby/groupby.py](https://codecov.io/gh/pandas-dev/pandas/pull/25576/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ3JvdXBieS9ncm91cGJ5LnB5) | `97.2% <ø> (ø)` | :arrow_up: |
| [pandas/core/arrays/sparse.py](https://codecov.io/gh/pandas-dev/pandas/pull/25576/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL3NwYXJzZS5weQ==) | `92.17% <ø> (ø)` | :arrow_up: |
| [pandas/core/arrays/period.py](https://codecov.io/gh/pandas-dev/pandas/pull/25576/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL3BlcmlvZC5weQ==) | `98.52% <ø> (ø)` | :arrow_up: |
| [pandas/core/internals/blocks.py](https://codecov.io/gh/pandas-dev/pandas/pull/25576/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW50ZXJuYWxzL2Jsb2Nrcy5weQ==) | `94.08% <ø> (ø)` | :arrow_up: |

------

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

@Naddiseo I think it would be worthile adding what you are running into code_checks.sh (maybe separate test) to avoid regressions here.
We'll leave that as a subtask for #25601.

Thanks @Naddiseo!

I'm curious @Naddiseo, what was your motivation for this PR? We're going to start adding type hints to the codebase when we make master python-3 only compatible (next week probably). If you have experience with typing, your input would be appreciated in #25601.
@TomAugspurger, I've found that a large number of the bugs in our code at $work could have been prevented if it had correct typing, so I'm slowly moving our code base to have more typing. A coworker of mine has recently started a ML sub-project that's integrated with my code, however I don't have a lot of experience with pandas/ML (maths/stats isn't my strong suit), so naturally I want to make sure I don't accidentally break my coworkers code because of not knowing the type of a variable. That led me to look for types for pandas/numpy, and not finding any for pandas, decided to use stubgen and subsequently finding the the issues addressed in this PR.