diff --git a/pandas/_libs/tslib.pyx b/pandas/_libs/tslib.pyx index c2d2acd95ce43..4201c499cce72 100644 --- a/pandas/_libs/tslib.pyx +++ b/pandas/_libs/tslib.pyx @@ -551,7 +551,7 @@ cpdef array_to_datetime( continue _ts = convert_str_to_tsobject( - val, None, unit="ns", dayfirst=dayfirst, yearfirst=yearfirst + val, None, dayfirst=dayfirst, yearfirst=yearfirst ) item_reso = _ts.creso state.update_creso(item_reso) @@ -716,7 +716,7 @@ cdef _array_to_datetime_object( try: tsobj = convert_str_to_tsobject( - val, None, unit="ns", dayfirst=dayfirst, yearfirst=yearfirst + val, None, dayfirst=dayfirst, yearfirst=yearfirst ) tsobj.ensure_reso(NPY_FR_ns, val) diff --git a/pandas/_libs/tslibs/conversion.pxd b/pandas/_libs/tslibs/conversion.pxd index e97f4900d20c8..7ffd630d6d8e1 100644 --- a/pandas/_libs/tslibs/conversion.pxd +++ b/pandas/_libs/tslibs/conversion.pxd @@ -37,7 +37,7 @@ cdef _TSObject convert_datetime_to_tsobject(datetime ts, tzinfo tz, int32_t nanos=*, NPY_DATETIMEUNIT reso=*) -cdef _TSObject convert_str_to_tsobject(str ts, tzinfo tz, str unit, +cdef _TSObject convert_str_to_tsobject(str ts, tzinfo tz, bint dayfirst=*, bint yearfirst=*) diff --git a/pandas/_libs/tslibs/conversion.pyx b/pandas/_libs/tslibs/conversion.pyx index 89b420b18a980..036faea0cdc1f 100644 --- a/pandas/_libs/tslibs/conversion.pyx +++ b/pandas/_libs/tslibs/conversion.pyx @@ -281,7 +281,7 @@ cdef _TSObject convert_to_tsobject(object ts, tzinfo tz, str unit, obj = _TSObject() if isinstance(ts, str): - return convert_str_to_tsobject(ts, tz, unit, dayfirst, yearfirst) + return convert_str_to_tsobject(ts, tz, dayfirst, yearfirst) if checknull_with_nat_and_na(ts): obj.value = NPY_NAT @@ -473,7 +473,7 @@ cdef _adjust_tsobject_tz_using_offset(_TSObject obj, tzinfo tz): check_overflows(obj, obj.creso) -cdef _TSObject convert_str_to_tsobject(str ts, tzinfo tz, str unit, +cdef _TSObject convert_str_to_tsobject(str ts, tzinfo tz, bint dayfirst=False, bint yearfirst=False): """ @@ -489,7 +489,6 @@ cdef _TSObject convert_str_to_tsobject(str ts, tzinfo tz, str unit, Value to be converted to _TSObject tz : tzinfo or None timezone for the timezone-aware output - unit : str or None dayfirst : bool, default False When parsing an ambiguous date string, interpret e.g. "3/4/1975" as April 3, as opposed to the standard US interpretation March 4.