Numeric Functions
Functions for numeric operations, bit manipulation, and mathematical computations.
numeric
bit_and
Returns a function that computes the bitwise AND operation between two values.
Parameters:
-
args
(str | Column | Func | int
, default:()
) βTwo values to compute the bitwise AND operation between. If a string is provided, it is assumed to be the name of the column. If a Column is provided, it is assumed to be a column. If a Func is provided, it is assumed to be a function returning an int. If an integer is provided, it is assumed to be a constant value.
Returns:
-
Func
(Func
) βA
Func
object that represents the bitwise AND function.
Example
Notes
- The result column will always be of type int.
Source code in datachain/func/numeric.py
bit_hamming_distance
Returns a function that computes the Hamming distance between two integers.
The Hamming distance is the number of positions at which the corresponding bits are different. This function returns the dissimilarity between the integers, where 0 indicates identical integers and values closer to the number of bits in the integer indicate higher dissimilarity.
Parameters:
-
args
(str | Column | Func | int
, default:()
) βTwo integers to compute the Hamming distance between. If a string is provided, it is assumed to be the name of the column. If a Column is provided, it is assumed to be a column. If a Func is provided, it is assumed to be a function returning an int. If an int is provided, it is assumed to be an integer literal.
Returns:
-
Func
(Func
) βA
Func
object that represents the Hamming distance function.
Example
Notes
- The result column will always be of type int.
Source code in datachain/func/numeric.py
bit_or
Returns a function that computes the bitwise OR operation between two values.
Parameters:
-
args
(str | Column | Func | int
, default:()
) βTwo values to compute the bitwise OR operation between. If a string is provided, it is assumed to be the name of the column. If a Column is provided, it is assumed to be a column. If a Func is provided, it is assumed to be a function returning an int. If an integer is provided, it is assumed to be a constant value.
Returns:
-
Func
(Func
) βA
Func
object that represents the bitwise OR function.
Example
Notes
- The result column will always be of type int.
Source code in datachain/func/numeric.py
bit_xor
Returns a function that computes the bitwise XOR operation between two values.
Parameters:
-
args
(str | Column | Func | int
, default:()
) βTwo values to compute the bitwise XOR operation between. If a string is provided, it is assumed to be the name of the column. If a Column is provided, it is assumed to be a column. If a Func is provided, it is assumed to be a function returning an int. If an integer is provided, it is assumed to be a constant value.
Returns:
-
Func
(Func
) βA
Func
object that represents the bitwise XOR function.
Example
Notes
- The result column will always be of type int.
Source code in datachain/func/numeric.py
int_hash_64
Returns a function that computes the 64-bit hash of an integer.
Parameters:
-
col
(str | Column | Func | int
) βInteger to compute the hash of. If a string is provided, it is assumed to be the name of the column. If a Column is provided, it is assumed to be a column. If a Func is provided, it is assumed to be a function returning an int. If an int is provided, it is assumed to be an int literal.
Returns:
-
Func
(Func
) βA
Func
object that represents the 64-bit hash function.
Notes
- The result column will always be of type int.