@@ -79,7 +79,7 @@ def __new__(cls, data, dtype=None, copy=False, name=None):
79
79
if (dtype is None
80
80
and (lib .is_datetime_array (subarr )
81
81
or lib .is_datetime64_array (subarr ))):
82
- return DatetimeIndex (subarr .astype ('M8' ), name = name )
82
+ return DatetimeIndex (subarr .astype ('M8[us] ' ), name = name )
83
83
84
84
if lib .is_integer_array (subarr ) and dtype is None :
85
85
return Int64Index (subarr .astype ('i8' ), name = name )
@@ -1062,17 +1062,17 @@ def __new__(cls, data, dtype=None, copy=False, name=None):
1062
1062
data = list (data )
1063
1063
1064
1064
# try to make it datetime64
1065
- data = np .asarray (data , dtype = np . datetime64 )
1065
+ data = np .asarray (data , dtype = 'M8[us]' )
1066
1066
1067
1067
if issubclass (data .dtype .type , basestring ):
1068
1068
raise TypeError ('String dtype not supported, you may need '
1069
1069
'to explicitly cast to datetime64' )
1070
1070
elif issubclass (data .dtype .type , np .integer ):
1071
- subarr = np .array (data , dtype = np . datetime64 , copy = copy )
1071
+ subarr = np .array (data , dtype = 'M8[us]' , copy = copy )
1072
1072
elif issubclass (data .dtype .type , np .datetime64 ):
1073
- subarr = np .array (data , dtype = np . datetime64 , copy = copy )
1073
+ subarr = np .array (data , dtype = 'M8[us]' , copy = copy )
1074
1074
else :
1075
- subarr = np .array (data , dtype = np . datetime64 , copy = copy )
1075
+ subarr = np .array (data , dtype = 'M8[us]' , copy = copy )
1076
1076
if len (data ) > 0 :
1077
1077
test = (subarr != data )
1078
1078
if (type (test ) == bool and test == True ) or test .any ():
@@ -1112,7 +1112,7 @@ def searchsorted(self, key, side='left'):
1112
1112
if isinstance (key , datetime ):
1113
1113
key = _dt_unbox (key )
1114
1114
elif isinstance (key , np .ndarray ):
1115
- key = np .array (key , dtype = np . datetime64 , copy = False )
1115
+ key = np .array (key , dtype = 'M8[us]' , copy = False )
1116
1116
elif not isinstance (key , np .datetime64 ):
1117
1117
raise TypeError ("Key %s is unrecognized type" % key )
1118
1118
return self .values .searchsorted (key , side = side )
@@ -1159,7 +1159,7 @@ def equals(self, other):
1159
1159
other = other .view ('i8' , type = np .ndarray )
1160
1160
elif other .inferred_type == 'datetime' :
1161
1161
# TODO: faster conversion from datetime object to datetime64?
1162
- other = np .array (other , dtype = 'M8' , copy = False )
1162
+ other = np .array (other , dtype = 'M8[us] ' , copy = False )
1163
1163
other = other .view ('i8' , type = np .ndarray )
1164
1164
elif len (other ) == 0 and len (self ) == 0 and other .dtype == object :
1165
1165
# fun corner case
0 commit comments