def hashable_rows(data, digits=None):
'''
We turn our array into integers, based on the precision
given by digits, and then put them in a hashable format.
Arguments
---------
data: (n,m) input array
digits: how many digits to add to hash, if data is floating point
If none, TOL_MERGE will be turned into a digit count and used.
Returns
---------
hashable: (n) length array of custom data which can be sorted
or used as hash keys
'''
as_int = float_to_int(data, digits)
dtype = np.dtype((np.void, as_int.dtype.itemsize * as_int.shape[1]))
hashable = np.ascontiguousarray(as_int).view(dtype).reshape(-1)
return hashable
评论列表
文章目录