Description
Describe the bug
When you do DataFrame.to_dict(orient="index")
, and you are using default integer index and string columns, you will get a Dict[int, Dict[str, Any]]
at runtime. The current annotations do not reflect this nested dictionary, they instead return a Dict[Hashable, Any]
. I understand that the exact type this returns has changed slightly after recent commits by @twoertwein, but the issue still stands.
Expectation: returns MutableMapping[Hashable, MutableMapping[Hashable, Any]]
This issue could be broadened to more precisely annotate all possible values of orient
if desired. For instance, orient="split"
probably should return a TypedDict
that has index
and columns
as keys.
To Reproduce
Any usage of to_dict(orient="index")
should reproduce this. Below is a screenshot of an example: