@@ -559,6 +559,7 @@ def _generate(cls, start, end, periods, name, freq,
559
559
arr = arr .view (_NS_DTYPE )
560
560
index = DatetimeIndex (arr )
561
561
562
+
562
563
# index is localized datetime64 array -> have to convert
563
564
# start/end as well to compare
564
565
if start is not None :
@@ -611,8 +612,8 @@ def _simple_new(cls, values, name=None, freq=None, tz=None,
611
612
dtype = dtype , ** kwargs )
612
613
values = np .array (values , copy = False )
613
614
614
- # values should be a numpy array
615
- assert isinstance (values , np . ndarray )
615
+ assert isinstance ( values , np . ndarray ), "values is not an np.ndarray"
616
+ assert is_datetime64_dtype (values )
616
617
617
618
if is_object_dtype (values ):
618
619
return cls (values , name = name , freq = freq , tz = tz ,
@@ -2094,6 +2095,8 @@ def _generate_regular_range(start, end, periods, freq):
2094
2095
"if a 'period' is given." )
2095
2096
2096
2097
data = np .arange (b , e , stride , dtype = np .int64 )
2098
+
2099
+ # _simple_new is getting an array of int64 here
2097
2100
data = DatetimeIndex ._simple_new (data , None , tz = tz )
2098
2101
else :
2099
2102
if isinstance (start , Timestamp ):
0 commit comments