ENH: Add typing for pandas.core.frame.dropna
State: closed

This PR adds type hinting for pandas.core.frame.dropna. Additionally, an explicit `return None` was added to the if/else block for in-place changes to meet mypy standards and make the types explicit.

I haven't yet run the tests, because I didn't modify any source code. Once/if the CI builds pass, I'll check it off the list.

- [x] closes #38948
- [x] tests added / passed
- [x] Ensure all linting tests pass, see [here](https://pandas.pydata.org/pandas-docs/dev/development/contributing.html#code-standards) for how to run them

Labels:
name: Typing
description: type annotations, mypy/pyright type checking
name: Stale

Comments:
Looking to add a "whatsnew" comment to the docs and see there's a tracker for v1.2.1 and v1.3.0, both of which aren't released. Which should I add to?
It's also worth noting that `mypy` throws a wall of errors on my local machine (Ubuntu 20.10, Kernel 5.8.0-33-generic), but none of them are related to any changes I made.

<details>

```python
pandas/core/computation/parsing.py:43: error: unused 'type: ignore' comment
pandas/io/common.py:182: error: Only @runtime_checkable protocols can be used with instance and class checks  [misc]
pandas/io/common.py:491: error: Unsupported operand types for + ("List[Optional[str]]" and "List[str]")  [operator]
pandas/_testing/contexts.py:128: error: Argument 1 to "close" has incompatible type "Optional[int]"; expected "int"  [arg-type]
pandas/core/aggregation.py:485: error: Value of type variable "_LT" of "sorted" cannot be "Optional[Hashable]"  [type-var]
pandas/core/aggregation.py:741: error: Value of type variable "_LT" of "sorted" cannot be "Optional[Hashable]"  [type-var]
pandas/core/groupby/ops.py:286: error: Incompatible types in assignment (expression has type "Index", variable has type "Iterator[Any]")  [assignment]
pandas/core/groupby/ops.py:286: note: 'Index' is missing following 'Iterator' protocol member:
pandas/core/groupby/ops.py:286: note:     __next__
pandas/core/reshape/pivot.py:198: error: Incompatible types in assignment (expression has type "Optional[DataFrame]", variable has type "DataFrame")  [assignment]
pandas/tests/groupby/test_categorical.py:1676: error: Item "None" of "Optional[DataFrame]" has no attribute "astype"  [union-attr]
pandas/tests/window/conftest.py:119: error: unused 'type: ignore' comment
pandas/tests/window/conftest.py:335: error: unused 'type: ignore' comment
pandas/tests/arrays/string_/test_string.py:25: error: unused 'type: ignore' comment
Found 12 errors in 9 files (checked 1160 source files)
```

<details>


@mzeitlin11 Any feedback would be appreciated - I'm not understanding why I'm seeing these build fails, particularly as the bits that are failing don't seem to be related to any changes I made!
So overloading the function signature to prevent type collision solved most of the bugs. I'm left with a mypy error about overloaded signature overlap with conflicting return types, which is not present when I run `./ci/code_checks.sh typing` locally. I'm making a full development environment to see if that helps troubleshoot the issue.

> Looking to add a "whatsnew" comment to the docs and see there's a tracker for v1.2.1 and v1.3.0, both of which aren't released. Which should I add to?

We generally don't add a whatsnew for a pure typing PR
> Looking to add a "whatsnew" comment to the docs and see there's a tracker for v1.2.1 and v1.3.0, both of which aren't released. Which should I add to?

not needed for typing
Also, @arw2019 `Literal` is official 3.8 and is only available in <=3.7 with the `typing_extensions` module, which mypy discusses [here](https://mypy.readthedocs.io/en/stable/literal_types.html). I only used as the `pandas.core.frame` module explicitly imports it here... 
https://github.com/pandas-dev/pandas/blob/67d4cae17bec45e84b9cf51bcf4fb5bbe293b26f/pandas/core/frame.py#L163-L164
> Also, @arw2019 `Literal` is official 3.8 and is only available in <=3.7 with the `typing_extensions` module, which mypy discusses [here](https://mypy.readthedocs.io/en/stable/literal_types.html). I only used as the `pandas.core.frame` module explicitly imports it here...
> https://github.com/pandas-dev/pandas/blob/67d4cae17bec45e84b9cf51bcf4fb5bbe293b26f/pandas/core/frame.py#L163-L164

yeah that's fine (esp as it's already imported)
Happy to see it approved! Let me know if I can help with anything else!
Out of curiosity, is there an official issue for tracking typing in pandas? I very strongly believe in typing and would be happy to contribute some spare time to progressing it coverage in the library!

> Happy to see it approved! Let me know if I can help with anything else!

FYI there will be at least one more round of review from someone else ;)

> Out of curiosity, is there an official issue for tracking typing in pandas? I very strongly believe in typing and would be happy to contribute some spare time to progressing it coverage in the library!

There are some issues in the tracker but we don't usually open issues unless there's something specific to discuss. 

We'd love for you to chime in and help to increase our coverage. Focused PRs like this one are best. For easy annotations (bool, str, etc.) we'll usually do a pass through a file just doing those and leaving the hard ones for dedicated PRs
This pull request is stale because it has been open for thirty days with no activity. Please update or respond to this comment if you're still interested in working on this.
@rbpatt2019 can you update to comments and merge master
closing as stale. @rbpatt2019 please ping if you want to pick this up again.