@@ -17,7 +17,7 @@ cnp.import_array()
17
17
import pytz
18
18
19
19
from pandas._libs.util cimport (
20
- is_integer_object, is_float_object, is_string_object, is_datetime64_object)
20
+ is_integer_object, is_float_object, is_datetime64_object)
21
21
22
22
23
23
from pandas._libs.tslibs.np_datetime cimport (
@@ -111,7 +111,7 @@ def ints_to_pydatetime(int64_t[:] arr, object tz=None, object freq=None,
111
111
elif box == " timestamp" :
112
112
func_create = create_timestamp_from_ts
113
113
114
- if is_string_object (freq):
114
+ if isinstance (freq, str ):
115
115
freq = to_offset(freq)
116
116
elif box == " time" :
117
117
func_create = create_time_from_ts
@@ -383,7 +383,7 @@ def array_with_unit_to_datetime(ndarray values, object unit,
383
383
raise AssertionError
384
384
iresult[i] = NPY_NAT
385
385
386
- elif is_string_object (val):
386
+ elif isinstance (val, str ):
387
387
if len (val) == 0 or val in nat_strings:
388
388
iresult[i] = NPY_NAT
389
389
@@ -442,7 +442,7 @@ def array_with_unit_to_datetime(ndarray values, object unit,
442
442
except :
443
443
oresult[i] = val
444
444
445
- elif is_string_object (val):
445
+ elif isinstance (val, str ):
446
446
if len (val) == 0 or val in nat_strings:
447
447
oresult[i] = NaT
448
448
@@ -569,7 +569,7 @@ cpdef array_to_datetime(ndarray[object] values, str errors='raise',
569
569
except :
570
570
iresult[i] = NPY_NAT
571
571
572
- elif is_string_object (val):
572
+ elif isinstance (val, str ):
573
573
# string
574
574
seen_string = 1
575
575
@@ -660,7 +660,7 @@ cpdef array_to_datetime(ndarray[object] values, str errors='raise',
660
660
if is_coerce:
661
661
iresult[i] = NPY_NAT
662
662
continue
663
- elif require_iso8601 and is_string_object (val):
663
+ elif require_iso8601 and isinstance (val, str ):
664
664
# GH#19382 for just-barely-OutOfBounds falling back to
665
665
# dateutil parser will return incorrect result because
666
666
# it will ignore nanoseconds
@@ -794,7 +794,7 @@ cdef array_to_datetime_object(ndarray[object] values, bint is_raise,
794
794
val = values[i]
795
795
if checknull_with_nat(val):
796
796
oresult[i] = val
797
- elif is_string_object (val):
797
+ elif isinstance (val, str ):
798
798
if len (val) == 0 or val in nat_strings:
799
799
oresult[i] = ' NaT'
800
800
continue
0 commit comments