We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ea680cd commit 64e0ae0Copy full SHA for 64e0ae0
pandas/core/frame.py
@@ -1914,13 +1914,15 @@ def from_dict(
1914
orient = orient.lower() # type: ignore[assignment]
1915
if orient == "index":
1916
if len(data) > 0:
1917
- index = list(data.keys())
1918
# TODO speed up Series case
1919
if isinstance(next(iter(data.values())), (Series, dict)):
+ original_keys = list(data.keys())
1920
data = _from_nested_dict(data)
1921
if not data and columns is None:
1922
columns = []
1923
+ index = original_keys
1924
else:
1925
+ index = list(data.keys())
1926
# error: Incompatible types in assignment (expression has type
1927
# "List[Any]", variable has type "Dict[Any, Any]")
1928
data = list(data.values()) # type: ignore[assignment]
0 commit comments