File tree 3 files changed +12
-4
lines changed
3 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -115,19 +115,27 @@ def time_maybe_convert_objects(self):
115
115
class ToDatetimeFromIntsFloats :
116
116
def setup (self ):
117
117
self .ts_sec = Series (range (1521080307 , 1521685107 ), dtype = "int64" )
118
+ self .ts_sec_uint = Series (range (1521080307 , 1521685107 ), dtype = "uint64" )
118
119
self .ts_sec_float = self .ts_sec .astype ("float64" )
119
120
120
121
self .ts_nanosec = 1_000_000 * self .ts_sec
122
+ self .ts_nanosec_uint = 1_000_000 * self .ts_sec_uint
121
123
self .ts_nanosec_float = self .ts_nanosec .astype ("float64" )
122
124
123
- # speed of int64 and float64 paths should be comparable
125
+ # speed of int64, uint64 and float64 paths should be comparable
124
126
125
127
def time_nanosec_int64 (self ):
126
128
to_datetime (self .ts_nanosec , unit = "ns" )
127
129
130
+ def time_nanosec_uint64 (self ):
131
+ to_datetime (self .ts_nanosec_uint , unit = "ns" )
132
+
128
133
def time_nanosec_float64 (self ):
129
134
to_datetime (self .ts_nanosec_float , unit = "ns" )
130
135
136
+ def time_sec_uint64 (self ):
137
+ to_datetime (self .ts_sec_uint , unit = "s" )
138
+
131
139
def time_sec_int64 (self ):
132
140
to_datetime (self .ts_sec , unit = "s" )
133
141
Original file line number Diff line number Diff line change @@ -245,7 +245,7 @@ Performance improvements
245
245
- Performance improvement in :meth: `DataFrame.corr ` for ``method=pearson `` on data without missing values (:issue: `40956 `)
246
246
- Performance improvement in some :meth: `GroupBy.apply ` operations (:issue: `42992 `)
247
247
- Performance improvement in :func: `read_stata ` (:issue: `43059 `)
248
- -
248
+ - Performance improvement in :meth: ` to_datetime ` with `` uint `` dtypes ( :issue: ` 42606 `)
249
249
250
250
.. ---------------------------------------------------------------------------
251
251
Original file line number Diff line number Diff line change @@ -248,7 +248,7 @@ def array_with_unit_to_datetime(
248
248
# if we have nulls that are not type-compat
249
249
# then need to iterate
250
250
251
- if values.dtype.kind == " i" or values.dtype.kind == " f" :
251
+ if values.dtype.kind in [ " i" , " f" , " u " ] :
252
252
iresult = values.astype(" i8" , copy = False )
253
253
# fill missing values by comparing to NPY_NAT
254
254
mask = iresult == NPY_NAT
@@ -263,7 +263,7 @@ def array_with_unit_to_datetime(
263
263
):
264
264
raise OutOfBoundsDatetime(f" cannot convert input with unit '{unit}'" )
265
265
266
- if values.dtype.kind == " i" :
266
+ if values.dtype.kind in [ " i" , " u " ] :
267
267
result = (iresult * m).astype(" M8[ns]" )
268
268
269
269
elif values.dtype.kind == " f" :
You can’t perform that action at this time.
0 commit comments