Note: This is an incomplete list of functionality.
isin_int64
,isin_int32
,isin_float64
,isin_float32
- the signature is
def isin_int64(int64_t[:] query, Int64Set db, uint8_t[:] result)
.query
andresult
must have the same size, otherwise an exception is raised. - Running time is
O(len(query))
s.
unique_int64
,unique_int32
,unique_float64
,unique_float32
- returns an object which implements the buffer protocol, so
np.ctypeslib.as_array
(recommended) ornp.frombuffer
(less safe, as memory can get reinterpreted) can be used to create numpy arrays. - differently as pandas, the returned uniques aren't in the order of the appearance.
- the signature is
unique_int64(buffer, size_hint=0.0)
the initial memory-consumption of the hash-set will belen(buffer)*size_hint
unlesssize_hint<=0.0
, in this case it will be ensured, that no rehashing is needed even if all elements are unique in the buffer. unique_stable_int64
,unique_stable_int32
,unique_stable_float64
,unique_stable_float32
order the elements in order of their appearance.
Following classes are defined:
Int64Set
for 64 bit integersInt32Set
for 32 bit integersFloat64Set
for 64 bit floatsFloat32Set
for 32 bit floatsPyObjectSet
for arbitrary Python-objects
with Python interface:
__len__
: number of elements in the set__contains__
: whether an element is contained in the setadd
: adds an element to setdiscard
: remove an element or do nothing if element is not in the set__iter__
: returns an iterator through all elements in set
with Cython interface:
contains
: checks whether an element is contained in the setadd
: adds an element to the setdiscard
: remove an element or do nothing if element is not in the setget_iter
: returns an iterator with the following Cython interface:has_next
:returns true if there are more elements in the iteratornext
:returns next element and moves the iterator
The following functions are available:
XXXXSet_from(it)
- creates aXXXXSet
from an iterable, withXXXX
being eitherInt64
,Int32
,Float64
,Float32
orPyObject
.XXXXSet_from_buffer(buf, size_hint=0.0)
creates aXXXXSet
from an object which implements buffer interface, withXXXX
being eitherInt64
,Int32
,Float64
,Float32
orPyObject
. Starting size of hash-set isint(size_hint*len(buf))
unlesssize_hint<=0.0
, in which case it will be ensured that no rehashing is needed.isin_xxxx(query, db, result)
evaluatesisin
forquery
being a buffer of the right type,db
- a correspondingXXXXSet
, and result a buffer for with 8bit-itemsize,xxxx
being eitherint64
,int32
,float64
,float32
orpyobject
.
Following classes are defined:
Int64toInt64Map
for mapping 64 bit integers to 64bit integer/floatsInt32toInt32Map
for mapping 32 bit integers to 32bit integer/floatsFloat64toInt64Map
for mapping 64 bit floats to 64bit integer/floatsFloat32toInt32Map
for mapping 32 bit floats to 32bit integer/floatsPyObjectMap
for arbitrary Python-objects as key/values
with Python interface:
__len__
: number of elements in the map__contains__
: whether an element is contained in the mapput_intXX/get_intXX
: setting/retrieving elements with XX=32 or 64 bits integerput_floatXX/get_floatXX
: setting/retrieving elements with XX=32 or 64 bits float__setitem__/__getitem___
: parameterfor_intXX
in the constructor deceides whether elements are intepreted as int or float (XX = 32 or 64 bits)discard
: remove an element or do nothing if element is not in the map__iter__
: returns an iterator through all elements in map
with Cython interface:
contains
: checks whether an element is contained in the mapput_intXX/get_intXX,put_floatXX/get_floatXX
: setting/getting elements in the mapdiscard
: remove an element or do nothing if element is not in the mapget_iter
: returns an iterator with the following Cython interface:has_next
:returns true if there are more elements in the iteratornext
:returns next element and moves the iterator
The following functions are available:
TypeXXtoXXMap_from_typeXX_buffer(keys, vals, size_hint=0.0)
- creates aTypeXXtoXXMyp
from buffers withType
eitherFloat
orInt
,XX
either 32 or 64 andtype
eitherfloat
orint
. Starting size of hash-map isint(size_hint*min(len(keys), len(vals)))
unlesssize_hint<=0.0
, in which case it will be ensured that no rehashing is needed.PyObjectMap_from_object_buffer
for keys, values as objects.