Skip to content

CLN: Add missing types to tslib.pyx #23966

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 28, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions pandas/_libs/tslib.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down