[docs]defunique_all(x:Array,/)->UniqueAllResult:""" Return a tuple of arrays containing: - the unique values in `x` - the indices of the first occurrence of each unique value - the inverse indices that reconstruct `x` from the unique values - the counts of each unique value """arrays=create_pdarrays(cast(str,generic_msg(cmd=f"uniqueAll<{x.dtype},{x.ndim}>",args={"name":x._array},),))returnUniqueAllResult(values=Array._new(arrays[0]),indices=Array._new(arrays[1]),inverse_indices=Array._new(arrays[2]),counts=Array._new(arrays[3]),)
[docs]defunique_counts(x:Array,/)->UniqueCountsResult:""" Return a tuple of arrays containing: - the unique values in `x` - the counts of each unique value """arrays=create_pdarrays(cast(str,generic_msg(cmd=f"uniqueCounts<{x.dtype},{x.ndim}>",args={"name":x._array},),))returnUniqueCountsResult(values=Array._new(arrays[0]),counts=Array._new(arrays[1]),)
[docs]defunique_inverse(x:Array,/)->UniqueInverseResult:""" Return a tuple of arrays containing: - the unique values in `x` - the inverse indices that reconstruct `x` from the unique values """arrays=create_pdarrays(cast(str,generic_msg(cmd=f"uniqueInverse<{x.dtype},{x.ndim}>",args={"name":x._array},),))returnUniqueInverseResult(values=Array._new(arrays[0]),inverse_indices=Array._new(arrays[1]),)
[docs]defunique_values(x:Array,/)->Array:""" Return an array containing the unique values from `x`. """returnArray._new(create_pdarray(cast(str,generic_msg(cmd=f"uniqueValues<{x.dtype},{x.ndim}>",args={"name":x._array},),)))