Skip to content

Commit f106d91

Browse files
committed
Don't discard blank Series/dicts
1 parent e9e1b32 commit f106d91

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pandas/core/frame.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1914,11 +1914,11 @@ def from_dict(
19141914
orient = orient.lower() # type: ignore[assignment]
19151915
if orient == "index":
19161916
if len(data) > 0:
1917+
index = list(data.keys())
19171918
# TODO speed up Series case
19181919
if isinstance(next(iter(data.values())), (Series, dict)):
19191920
data = _from_nested_dict(data)
19201921
else:
1921-
index = list(data.keys())
19221922
# error: Incompatible types in assignment (expression has type
19231923
# "List[Any]", variable has type "Dict[Any, Any]")
19241924
data = list(data.values()) # type: ignore[assignment]

0 commit comments

Comments
 (0)