def _init_dict(self, data, index=None, dtype=None):
<EOL>if data:<EOL><INDENT>keys, values = zip(*data.items())<EOL>values = list(values)<EOL><DEDENT>elif index is not None:<EOL><INDENT>values = na_value_for_dtype(dtype)<EOL>keys = index<EOL><DEDENT>else:<EOL><INDENT>keys, values = [], []<EOL><DEDENT>s = Series(values, index=keys, dtype=dtype)<EOL>if data and index is not None:<EOL><INDENT>s = s.reindex(index, copy=False)<EOL><DEDENT>elif not PY36 and not isinstance(data, OrderedDict) and data:<EOL><INDENT>try:<EOL><INDENT>s = s.sort_index()<EOL><DEDENT>except TypeError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>return s._data, s.index<EOL>
Derive the "_data" and "index" attributes of a new Series from a
dictionary input.

Parameters
----------
data : dict or dict-like
    Data used to populate the new Series
index : Index or index-like, default None
    index for the new Series: if None, use dict keys
dtype : dtype, default None
    dtype for the new Series: if None, infer from data

Returns
-------
_data : BlockManager for the new Series
index : index for the new Series