Skip to content

Commit ca70fe6

Browse files
mroeschkejreback
authored andcommitted
CLN: Add more cdefs for tslib.pyx (pandas-dev#23966)
1 parent db8d33e commit ca70fe6

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

pandas/_libs/tslib.pyx

+15-10
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ cdef inline object create_time_from_ts(
7676

7777
@cython.wraparound(False)
7878
@cython.boundscheck(False)
79-
def ints_to_pydatetime(int64_t[:] arr, tz=None, freq=None, box="datetime"):
79+
def ints_to_pydatetime(int64_t[:] arr, object tz=None, object freq=None,
80+
str box="datetime"):
8081
"""
8182
Convert an i8 repr to an ndarray of datetimes, date, time or Timestamp
8283
@@ -104,8 +105,9 @@ def ints_to_pydatetime(int64_t[:] arr, tz=None, freq=None, box="datetime"):
104105
int64_t[:] deltas
105106
Py_ssize_t pos
106107
npy_datetimestruct dts
107-
object dt
108-
int64_t value, delta
108+
object dt, new_tz
109+
str typ
110+
int64_t value, delta, local_value
109111
ndarray[object] result = np.empty(n, dtype=object)
110112
object (*func_create)(int64_t, npy_datetimestruct, object, object)
111113

@@ -303,7 +305,8 @@ def format_array_from_datetime(ndarray[int64_t] values, object tz=None,
303305
return result
304306

305307

306-
def array_with_unit_to_datetime(ndarray values, unit, errors='coerce'):
308+
def array_with_unit_to_datetime(ndarray values, object unit,
309+
str errors='coerce'):
307310
"""
308311
convert the ndarray according to the unit
309312
if errors:
@@ -458,10 +461,10 @@ def array_with_unit_to_datetime(ndarray values, unit, errors='coerce'):
458461

459462
@cython.wraparound(False)
460463
@cython.boundscheck(False)
461-
cpdef array_to_datetime(ndarray[object] values, errors='raise',
462-
dayfirst=False, yearfirst=False,
463-
format=None, utc=None,
464-
require_iso8601=False):
464+
cpdef array_to_datetime(ndarray[object] values, str errors='raise',
465+
bint dayfirst=False, bint yearfirst=False,
466+
object format=None, object utc=None,
467+
bint require_iso8601=False):
465468
"""
466469
Converts a 1D array of date-like values to a numpy array of either:
467470
1) datetime64[ns] data
@@ -510,9 +513,11 @@ cpdef array_to_datetime(ndarray[object] values, errors='raise',
510513
bint is_raise = errors=='raise'
511514
bint is_ignore = errors=='ignore'
512515
bint is_coerce = errors=='coerce'
516+
bint is_same_offsets
513517
_TSObject _ts
518+
int64_t value
514519
int out_local=0, out_tzoffset=0
515-
float offset_seconds
520+
float offset_seconds, tz_offset
516521
set out_tzoffset_vals = set()
517522

518523
# specify error conditions
@@ -764,7 +769,7 @@ cpdef array_to_datetime(ndarray[object] values, errors='raise',
764769
@cython.wraparound(False)
765770
@cython.boundscheck(False)
766771
cdef array_to_datetime_object(ndarray[object] values, bint is_raise,
767-
dayfirst=False, yearfirst=False):
772+
bint dayfirst=False, bint yearfirst=False):
768773
"""
769774
Fall back function for array_to_datetime
770775

0 commit comments

Comments
 (0)