Skip to content

Remove src/numpy.pxd #19418

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 4 commits into from
Jan 27, 2018
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
8 changes: 6 additions & 2 deletions pandas/_libs/index.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@ from cpython.slice cimport PySlice_Check

import numpy as np
cimport numpy as cnp
from numpy cimport (ndarray, float64_t, int32_t, int64_t, uint8_t, uint64_t,
NPY_DATETIME, NPY_TIMEDELTA)
from numpy cimport ndarray, float64_t, int32_t, int64_t, uint8_t, uint64_t
cnp.import_array()

cdef extern from "numpy/arrayobject.h":
# These can be cimported directly from numpy in cython>=0.27.3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should prob put array dtype introspection in a single place and expose viais_timedelta64_array (new) somewhere maybe util.pxd

cdef enum NPY_TYPES:
NPY_DATETIME
NPY_TIMEDELTA

cimport util

Expand Down
22 changes: 19 additions & 3 deletions pandas/_libs/src/inference.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,22 @@ iNaT = util.get_nat()
cdef bint PY2 = sys.version_info[0] == 2
cdef double nan = <double> np.NaN

cdef extern from "numpy/arrayobject.h":
# cython's numpy.dtype specification is incorrect, which leads to
# errors in issubclass(self.dtype.type, np.bool_), so we directly
# include the correct version
# https://github.com/cython/cython/issues/2022

ctypedef class numpy.dtype [object PyArray_Descr]:
# Use PyDataType_* macros when possible, however there are no macros
# for accessing some of the fields, so some are defined. Please
# ask on cython-dev if you need more.
cdef int type_num
cdef int itemsize "elsize"
cdef char byteorder
cdef object fields
cdef tuple names

from util cimport UINT8_MAX, UINT64_MAX, INT64_MAX, INT64_MIN

# core.common import for fast inference checks
Expand Down Expand Up @@ -609,13 +625,13 @@ cdef class Validator:

cdef:
Py_ssize_t n
cnp.dtype dtype
dtype dtype
bint skipna

def __cinit__(
self,
Py_ssize_t n,
cnp.dtype dtype=np.dtype(np.object_),
dtype dtype=np.dtype(np.object_),
bint skipna=False
):
self.n = n
Expand Down Expand Up @@ -823,7 +839,7 @@ cdef class TemporalValidator(Validator):
def __cinit__(
self,
Py_ssize_t n,
cnp.dtype dtype=np.dtype(np.object_),
dtype dtype=np.dtype(np.object_),
bint skipna=False
):
self.n = n
Expand Down
Loading