1
- from datetime import datetime, timedelta, date
2
1
import warnings
3
2
4
- import cython
5
-
6
3
import numpy as np
7
4
cimport numpy as cnp
8
5
from numpy cimport (ndarray, intp_t,
9
6
float64_t, float32_t,
10
7
int64_t, int32_t, int16_t, int8_t,
11
- uint64_t, uint32_t, uint16_t, uint8_t,
12
- # Note: NPY_DATETIME, NPY_TIMEDELTA are only available
13
- # for cimport in cython>=0.27.3
14
- NPY_DATETIME, NPY_TIMEDELTA)
8
+ uint64_t, uint32_t, uint16_t, uint8_t
9
+ )
15
10
cnp.import_array()
16
11
17
12
@@ -23,7 +18,7 @@ from pandas._libs.tslibs.c_timestamp cimport _Timestamp
23
18
from pandas._libs.hashtable cimport HashTable
24
19
25
20
from pandas._libs import algos, hashtable as _hash
26
- from pandas._libs.tslibs import Timestamp, Timedelta, period as periodlib
21
+ from pandas._libs.tslibs import Timedelta, period as periodlib
27
22
from pandas._libs.missing import checknull
28
23
29
24
@@ -35,16 +30,6 @@ cdef inline bint is_definitely_invalid_key(object val):
35
30
return False
36
31
37
32
38
- cpdef get_value_at(ndarray arr, object loc, object tz = None ):
39
- obj = util.get_value_at(arr, loc)
40
-
41
- if arr.descr.type_num == NPY_DATETIME:
42
- return Timestamp(obj, tz = tz)
43
- elif arr.descr.type_num == NPY_TIMEDELTA:
44
- return Timedelta(obj)
45
- return obj
46
-
47
-
48
33
# Don't populate hash tables in monotonic indexes larger than this
49
34
_SIZE_CUTOFF = 1 _000_000
50
35
@@ -72,21 +57,6 @@ cdef class IndexEngine:
72
57
self._ensure_mapping_populated()
73
58
return val in self.mapping
74
59
75
- cpdef get_value(self , ndarray arr , object key , object tz = None ):
76
- """
77
- Parameters
78
- ----------
79
- arr : 1-dimensional ndarray
80
- """
81
- cdef:
82
- object loc
83
-
84
- loc = self .get_loc(key)
85
- if isinstance (loc, slice ) or util.is_array(loc):
86
- return arr[loc]
87
- else :
88
- return get_value_at(arr, loc, tz = tz)
89
-
90
60
cpdef get_loc(self , object val ):
91
61
cdef:
92
62
Py_ssize_t loc
0 commit comments