diff --git a/pandas/_libs/tslib.pyx b/pandas/_libs/tslib.pyx index c5bc969ede3c9..ddeaffbfb3cc0 100644 --- a/pandas/_libs/tslib.pyx +++ b/pandas/_libs/tslib.pyx @@ -76,7 +76,8 @@ cdef inline object create_time_from_ts( @cython.wraparound(False) @cython.boundscheck(False) -def ints_to_pydatetime(int64_t[:] arr, tz=None, freq=None, box="datetime"): +def ints_to_pydatetime(int64_t[:] arr, object tz=None, object freq=None, + str box="datetime"): """ Convert an i8 repr to an ndarray of datetimes, date, time or Timestamp @@ -104,8 +105,9 @@ def ints_to_pydatetime(int64_t[:] arr, tz=None, freq=None, box="datetime"): int64_t[:] deltas Py_ssize_t pos npy_datetimestruct dts - object dt - int64_t value, delta + object dt, new_tz + str typ + int64_t value, delta, local_value ndarray[object] result = np.empty(n, dtype=object) object (*func_create)(int64_t, npy_datetimestruct, object, object) @@ -303,7 +305,8 @@ def format_array_from_datetime(ndarray[int64_t] values, object tz=None, return result -def array_with_unit_to_datetime(ndarray values, unit, errors='coerce'): +def array_with_unit_to_datetime(ndarray values, object unit, + str errors='coerce'): """ convert the ndarray according to the unit if errors: @@ -458,10 +461,10 @@ def array_with_unit_to_datetime(ndarray values, unit, errors='coerce'): @cython.wraparound(False) @cython.boundscheck(False) -cpdef array_to_datetime(ndarray[object] values, errors='raise', - dayfirst=False, yearfirst=False, - format=None, utc=None, - require_iso8601=False): +cpdef array_to_datetime(ndarray[object] values, str errors='raise', + bint dayfirst=False, bint yearfirst=False, + object format=None, object utc=None, + bint require_iso8601=False): """ Converts a 1D array of date-like values to a numpy array of either: 1) datetime64[ns] data @@ -510,9 +513,11 @@ cpdef array_to_datetime(ndarray[object] values, errors='raise', bint is_raise = errors=='raise' bint is_ignore = errors=='ignore' bint is_coerce = errors=='coerce' + bint is_same_offsets _TSObject _ts + int64_t value int out_local=0, out_tzoffset=0 - float offset_seconds + float offset_seconds, tz_offset set out_tzoffset_vals = set() # specify error conditions @@ -764,7 +769,7 @@ cpdef array_to_datetime(ndarray[object] values, errors='raise', @cython.wraparound(False) @cython.boundscheck(False) cdef array_to_datetime_object(ndarray[object] values, bint is_raise, - dayfirst=False, yearfirst=False): + bint dayfirst=False, bint yearfirst=False): """ Fall back function for array_to_datetime