@@ -5,6 +5,35 @@ WARNING: DO NOT edit .pxi FILE directly, .pxi is generated from .pxi.in
55"""
66
77
8+ {{py:
9+
10+ # name
11+ cimported_types = ['float32',
12+ 'float64',
13+ 'int8',
14+ 'int16',
15+ 'int32',
16+ 'int64',
17+ 'pymap',
18+ 'str',
19+ 'strbox',
20+ 'uint8',
21+ 'uint16',
22+ 'uint32',
23+ 'uint64']
24+ }}
25+
26+ {{for name in cimported_types}}
27+ from pandas._libs.khash cimport (
28+ kh_destroy_{{name}},
29+ kh_exist_{{name}},
30+ kh_get_{{name}},
31+ kh_init_{{name}},
32+ kh_put_{{name}},
33+ kh_resize_{{name}},
34+ )
35+ {{endfor}}
36+
837# ----------------------------------------------------------------------
938# VectorData
1039# ----------------------------------------------------------------------
@@ -20,9 +49,16 @@ from pandas._libs.missing cimport C_NA
2049# for uniques in hashtables)
2150
2251dtypes = [('Float64', 'float64', 'float64_t'),
52+ ('Float32', 'float32', 'float32_t'),
2353 ('Int64', 'int64', 'int64_t'),
54+ ('Int32', 'int32', 'int32_t'),
55+ ('Int16', 'int16', 'int16_t'),
56+ ('Int8', 'int8', 'int8_t'),
2457 ('String', 'string', 'char *'),
25- ('UInt64', 'uint64', 'uint64_t')]
58+ ('UInt64', 'uint64', 'uint64_t'),
59+ ('UInt32', 'uint32', 'uint32_t'),
60+ ('UInt16', 'uint16', 'uint16_t'),
61+ ('UInt8', 'uint8', 'uint8_t')]
2662}}
2763
2864{{for name, dtype, c_type in dtypes}}
@@ -49,8 +85,15 @@ cdef inline void append_data_{{dtype}}({{name}}VectorData *data,
4985
5086ctypedef fused vector_data:
5187 Int64VectorData
88+ Int32VectorData
89+ Int16VectorData
90+ Int8VectorData
5291 UInt64VectorData
92+ UInt32VectorData
93+ UInt16VectorData
94+ UInt8VectorData
5395 Float64VectorData
96+ Float32VectorData
5497 StringVectorData
5598
5699cdef inline bint needs_resize(vector_data *data) nogil:
@@ -65,7 +108,14 @@ cdef inline bint needs_resize(vector_data *data) nogil:
65108# name, dtype, c_type
66109dtypes = [('Float64', 'float64', 'float64_t'),
67110 ('UInt64', 'uint64', 'uint64_t'),
68- ('Int64', 'int64', 'int64_t')]
111+ ('Int64', 'int64', 'int64_t'),
112+ ('Float32', 'float32', 'float32_t'),
113+ ('UInt32', 'uint32', 'uint32_t'),
114+ ('Int32', 'int32', 'int32_t'),
115+ ('UInt16', 'uint16', 'uint16_t'),
116+ ('Int16', 'int16', 'int16_t'),
117+ ('UInt8', 'uint8', 'uint8_t'),
118+ ('Int8', 'int8', 'int8_t')]
69119
70120}}
71121
@@ -253,15 +303,22 @@ cdef class HashTable:
253303
254304{{py:
255305
256- # name, dtype, float_group, default_na_value
257- dtypes = [('Float64', 'float64', True, 'np.nan'),
258- ('UInt64', 'uint64', False, 0),
259- ('Int64', 'int64', False, 'NPY_NAT')]
306+ # name, dtype, float_group
307+ dtypes = [('Float64', 'float64', True),
308+ ('UInt64', 'uint64', False),
309+ ('Int64', 'int64', False),
310+ ('Float32', 'float32', True),
311+ ('UInt32', 'uint32', False),
312+ ('Int32', 'int32', False),
313+ ('UInt16', 'uint16', False),
314+ ('Int16', 'int16', False),
315+ ('UInt8', 'uint8', False),
316+ ('Int8', 'int8', False)]
260317
261318}}
262319
263320
264- {{for name, dtype, float_group, default_na_value in dtypes}}
321+ {{for name, dtype, float_group in dtypes}}
265322
266323cdef class {{name}}HashTable(HashTable):
267324
@@ -430,7 +487,7 @@ cdef class {{name}}HashTable(HashTable):
430487 # which is only used if it's *specified*.
431488 na_value2 = <{{dtype}}_t>na_value
432489 else:
433- na_value2 = {{default_na_value}}
490+ na_value2 = 0
434491
435492 with nogil:
436493 for i in range(n):
0 commit comments