|
28 | 28 | is_sequence, _infer_dtype_from_scalar, _values_from_object, is_list_like,
|
29 | 29 | _maybe_box_datetimelike, is_categorical_dtype, is_object_dtype,
|
30 | 30 | is_internal_type, is_datetimetz, _possibly_infer_to_datetimelike,
|
31 |
| - _dict_compat) |
| 31 | + _dict_compat, is_dict_like) |
32 | 32 | from pandas.core.generic import NDFrame, _shared_docs
|
33 | 33 | from pandas.core.index import Index, MultiIndex, _ensure_index
|
34 | 34 | from pandas.core.indexing import (maybe_droplevels, convert_to_index_sliceable,
|
@@ -219,8 +219,6 @@ def __init__(self, data=None, index=None, columns=None, dtype=None,
|
219 | 219 | if isinstance(data, BlockManager):
|
220 | 220 | mgr = self._init_mgr(data, axes=dict(index=index, columns=columns),
|
221 | 221 | dtype=dtype, copy=copy)
|
222 |
| - elif isinstance(data, dict): |
223 |
| - mgr = self._init_dict(data, index, columns, dtype=dtype) |
224 | 222 | elif isinstance(data, ma.MaskedArray):
|
225 | 223 | import numpy.ma.mrecords as mrecords
|
226 | 224 | # masked recarray
|
@@ -252,6 +250,8 @@ def __init__(self, data=None, index=None, columns=None, dtype=None,
|
252 | 250 | else:
|
253 | 251 | mgr = self._init_ndarray(data, index, columns, dtype=dtype,
|
254 | 252 | copy=copy)
|
| 253 | + elif is_dict_like(data): |
| 254 | + mgr = self._init_dict(data, index, columns, dtype=dtype) |
255 | 255 | elif isinstance(data, (list, types.GeneratorType)):
|
256 | 256 | if isinstance(data, types.GeneratorType):
|
257 | 257 | data = list(data)
|
|
0 commit comments