Move time conversion funcs to tslibs.conversion by jbrockmendel · Pull Request #17708 · pandas-dev/pandas (original) (raw)

Eventually a bunch of _TSObject logic belongs in tslibs.conversion. To start off small, this just moves a few out-of-place functions from _libs.lib and _libs.index.

The changes that are not cut/paste:

In _to_i8: tslib._delta_to_nanoseconds(offset) became int(offset.total_seconds() * 1e9)
In array_to_timestamp and time64_to_datetime: for i from 0 <= i < n: became for i in range(n):

Right now the functions moved from lib are imported with a # noqa. If OK, I'll follow-up by updating the imports elsewhere.