Skip to content

Commit f17f0af

Browse files
committed
Permit any Mapping as source of DataFrame
1 parent b5b2d38 commit f17f0af

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

pandas/core/frame.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ def __init__(
739739
raise ValueError("columns cannot be a set")
740740

741741
if copy is None:
742-
if isinstance(data, dict):
742+
if isinstance(data, Mapping):
743743
# retain pre-GH#38939 default behavior
744744
copy = True
745745
elif not isinstance(data, (Index, DataFrame, Series)):
@@ -758,7 +758,7 @@ def __init__(
758758
data, axes={"index": index, "columns": columns}, dtype=dtype, copy=copy
759759
)
760760

761-
elif isinstance(data, dict):
761+
elif isinstance(data, Mapping):
762762
# GH#38939 de facto copy defaults to False only in non-dict cases
763763
mgr = dict_to_mgr(data, index, columns, dtype=dtype, copy=copy)
764764
elif isinstance(data, ma.MaskedArray):

pandas/core/internals/construction.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ def _check_values_indices_shape_match(
347347

348348

349349
def dict_to_mgr(
350-
data: dict,
350+
data: Mapping,
351351
index,
352352
columns,
353353
*,

0 commit comments

Comments
 (0)