def _reconstruct_data(values, dtype, original):
from pandas import Index<EOL>if is_extension_array_dtype(dtype):<EOL><INDENT>values = dtype.construct_array_type()._from_sequence(values)<EOL><DEDENT>elif is_datetime64tz_dtype(dtype) or is_period_dtype(dtype):<EOL><INDENT>values = Index(original)._shallow_copy(values, name=None)<EOL><DEDENT>elif is_bool_dtype(dtype):<EOL><INDENT>values = values.astype(dtype)<EOL>if isinstance(original, Index):<EOL><INDENT>values = values.astype(object)<EOL><DEDENT><DEDENT>elif dtype is not None:<EOL><INDENT>values = values.astype(dtype)<EOL><DEDENT>return values<EOL>
reverse of _ensure_data

Parameters
----------
values : ndarray
dtype : pandas_dtype
original : ndarray-like

Returns
-------
Index for extension types, otherwise ndarray casted to dtype