Skip to content

Commit 64e0ae0

Browse files
Trigger CI
1 parent ea680cd commit 64e0ae0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pandas/core/frame.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1914,13 +1914,15 @@ def from_dict(
19141914
orient = orient.lower() # type: ignore[assignment]
19151915
if orient == "index":
19161916
if len(data) > 0:
1917-
index = list(data.keys())
19181917
# TODO speed up Series case
19191918
if isinstance(next(iter(data.values())), (Series, dict)):
1919+
original_keys = list(data.keys())
19201920
data = _from_nested_dict(data)
19211921
if not data and columns is None:
19221922
columns = []
1923+
index = original_keys
19231924
else:
1925+
index = list(data.keys())
19241926
# error: Incompatible types in assignment (expression has type
19251927
# "List[Any]", variable has type "Dict[Any, Any]")
19261928
data = list(data.values()) # type: ignore[assignment]

0 commit comments

Comments
 (0)