def _normalize_array(data):
    data_dtype = data.dtype
    if data_dtype == bool_:
        return data.astype(uint8), dtype(bool_)
    elif data_dtype in FLOAT_DTYPES:
        return data.astype(float64), dtype(float64)
    elif data_dtype in INT_DTYPES:
        return data.astype(int64), dtype(int64)
    elif data_dtype.name.startswith('datetime'):
        try:
            outarray = data.astype('datetime64[ns]').view('int64')
            return outarray, datetime64ns_dtype
        except OverflowError:
            raise ValueError(
                "AdjustedArray received a datetime array "
                "not representable as datetime64[ns].\n"
                "Min Date: %s\n"
                "Max Date: %s\n"
                % (data.min(), data.max())
            )
    else:
        raise TypeError(
            "Don't know how to construct AdjustedArray "
            "on data of type %s." % data_dtype
        )
Coerce buffer data for an AdjustedArray into a standard scalar
dataset/ETHPy150Open quantopian/zipline/zipline/lib/adjusted_array.py/_normalize_array