Skip to content

move implementation of Timedelta to tslibs.timedeltas #18085

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 16 commits into from
Nov 8, 2017
Merged
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions pandas/_libs/period.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ from pandas._libs import tslib
from pandas._libs.tslib import Timestamp, iNaT, NaT
from tslibs.timezones cimport (
is_utc, is_tzlocal, get_utcoffset, get_dst_info, maybe_get_tz)
from tslibs.timedeltas cimport delta_to_nanoseconds

from tslibs.parsing import parse_time_string, NAT_SENTINEL
from tslibs.frequencies cimport get_freq_code
Expand Down Expand Up @@ -716,8 +717,8 @@ cdef class _Period(object):
if isinstance(other, (timedelta, np.timedelta64, offsets.Tick)):
offset = frequencies.to_offset(self.freq.rule_code)
if isinstance(offset, offsets.Tick):
nanos = tslib._delta_to_nanoseconds(other)
offset_nanos = tslib._delta_to_nanoseconds(offset)
nanos = delta_to_nanoseconds(other)
offset_nanos = delta_to_nanoseconds(offset)

if nanos % offset_nanos == 0:
ordinal = self.ordinal + (nanos // offset_nanos)
Expand Down
3 changes: 2 additions & 1 deletion pandas/_libs/src/inference.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ from decimal import Decimal
cimport util
cimport cython
from tslibs.nattype import NaT
from tslib cimport convert_to_tsobject, convert_to_timedelta64
from tslib cimport convert_to_tsobject
from tslibs.timedeltas cimport convert_to_timedelta64
from tslibs.timezones cimport get_timezone
from datetime import datetime, timedelta
iNaT = util.get_nat()
Expand Down
1 change: 0 additions & 1 deletion pandas/_libs/tslib.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ from numpy cimport ndarray, int64_t

from tslibs.conversion cimport convert_to_tsobject

cpdef convert_to_timedelta64(object, object)
cdef bint _check_all_nulls(obj)

cdef _to_i8(object val)
Loading