diff --git a/pandas/_libs/src/inference.pyx b/pandas/_libs/src/inference.pyx index 6e964077dd56e..cb192fcced318 100644 --- a/pandas/_libs/src/inference.pyx +++ b/pandas/_libs/src/inference.pyx @@ -3,7 +3,7 @@ from decimal import Decimal cimport util cimport cython from tslibs.nattype import NaT -from tslib cimport convert_to_tsobject +from tslibs.conversion cimport convert_to_tsobject from tslibs.timedeltas cimport convert_to_timedelta64 from tslibs.timezones cimport get_timezone from datetime import datetime, timedelta diff --git a/pandas/_libs/tslib.pxd b/pandas/_libs/tslib.pxd deleted file mode 100644 index b74cf5b79c4cb..0000000000000 --- a/pandas/_libs/tslib.pxd +++ /dev/null @@ -1,3 +0,0 @@ -from numpy cimport ndarray, int64_t - -from tslibs.conversion cimport convert_to_tsobject diff --git a/pandas/_libs/tslib.pyx b/pandas/_libs/tslib.pyx index 6d8cf39114f6f..020ac812e1c20 100644 --- a/pandas/_libs/tslib.pyx +++ b/pandas/_libs/tslib.pyx @@ -5,8 +5,9 @@ # distutils: define_macros=CYTHON_TRACE_NOGIL=0 cimport numpy as np -from numpy cimport int64_t, import_array, ndarray, float64_t +from numpy cimport int64_t, ndarray, float64_t import numpy as np +np.import_array() from cpython cimport PyTypeObject, PyFloat_Check @@ -35,18 +36,15 @@ from tslibs.np_datetime cimport (check_dts_bounds, dayofweek, is_leapyear) from tslibs.np_datetime import OutOfBoundsDatetime -from .tslibs.parsing import parse_datetime_string +from tslibs.parsing import parse_datetime_string cimport cython +from cython cimport Py_ssize_t -import warnings import pytz UTC = pytz.utc -# initialize numpy -import_array() - from tslibs.timedeltas cimport cast_from_unit from tslibs.timedeltas import Timedelta diff --git a/setup.py b/setup.py index 37be0b696503d..da897b0b539b6 100755 --- a/setup.py +++ b/setup.py @@ -517,7 +517,9 @@ def pxd(name): 'depends': _pxi_dep['join']}, '_libs.lib': { 'pyxfile': '_libs/lib', - 'pxdfiles': ['_libs/src/util', '_libs/missing'], + 'pxdfiles': ['_libs/src/util', + '_libs/missing', + '_libs/tslibs/conversion'], 'depends': lib_depends + tseries_depends}, '_libs.missing': { 'pyxfile': '_libs/missing',