@@ -801,9 +801,9 @@ cdef class DayOffset(_Offset):
801
801
# offset.next()
802
802
# return i
803
803
804
- def string_to_datetime (ndarray[object] strings , raise_ = False , dayfirst = False ):
804
+ def array_to_datetime (ndarray[object] values , raise_ = False , dayfirst = False ):
805
805
cdef:
806
- Py_ssize_t i, n = len (strings )
806
+ Py_ssize_t i, n = len (values )
807
807
object val
808
808
ndarray[int64_t] iresult
809
809
ndarray[object ] oresult
@@ -815,7 +815,7 @@ def string_to_datetime(ndarray[object] strings, raise_=False, dayfirst=False):
815
815
result = np.empty(n, dtype = ' M8[ns]' )
816
816
iresult = result.view(' i8' )
817
817
for i in range (n):
818
- val = strings [i]
818
+ val = values [i]
819
819
if util._checknull(val):
820
820
iresult[i] = NaT
821
821
elif PyDateTime_Check(val):
@@ -824,6 +824,8 @@ def string_to_datetime(ndarray[object] strings, raise_=False, dayfirst=False):
824
824
iresult[i] = _date_to_datetime64(val, & dts)
825
825
elif util.is_datetime64_object(val):
826
826
iresult[i] = _get_datetime64_nanos(val)
827
+ elif util.is_integer_object(val):
828
+ iresult[i] = val
827
829
else :
828
830
if len (val) == 0 :
829
831
iresult[i] = NaT
@@ -837,7 +839,7 @@ def string_to_datetime(ndarray[object] strings, raise_=False, dayfirst=False):
837
839
oresult = np.empty(n, dtype = object )
838
840
839
841
for i in range (n):
840
- val = strings [i]
842
+ val = values [i]
841
843
if util._checknull(val):
842
844
oresult[i] = val
843
845
else :
@@ -849,7 +851,7 @@ def string_to_datetime(ndarray[object] strings, raise_=False, dayfirst=False):
849
851
except Exception :
850
852
if raise_:
851
853
raise
852
- return strings
854
+ return values
853
855
# oresult[i] = val
854
856
855
857
return oresult
0 commit comments