pub fn div<T>(lhs: &PrimitiveArray<T>, rhs: &PrimitiveArray<T>) -> Result<PrimitiveArray<T>>
where
    T: NativeType + Div<Output = T>,
{
    check_same_type(lhs, rhs)?;

    if rhs.null_count() == 0 {
        binary(lhs, rhs, lhs.data_type().clone(), |a, b| a / b)
    } else {
        check_same_len(lhs, rhs)?;
        let values = lhs.iter().zip(rhs.iter()).map(|(l, r)| match (l, r) {
            (Some(l), Some(r)) => Some(*l / *r),
            _ => None,
        });

        Ok(PrimitiveArray::from_trusted_len_iter(values).to(lhs.data_type().clone()))
    }
}
/// Divides two primitive arrays with the same type.
/// Panics if the divisor is zero of one pair of values overflows.
///
/// # Examples
/// ```
/// use arrow2::compute::arithmetics::basic::div;
/// use arrow2::array::Int32Array;
///
/// let a = Int32Array::from(&[Some(10), Some(1), Some(6)]);
/// let b = Int32Array::from(&[Some(5), None, Some(6)]);
/// let result = div(&a, &b).unwrap();
/// let expected = Int32Array::from(&[Some(2), None, Some(1)]);
/// assert_eq!(result, expected)
/// ```
Divides two primitive arrays with the same type.
Panics if the divisor is zero of one pair of values overflows.
Divides two primitive arrays with the same type . Panics if the divisor is zero of one pair of values overflows .
pub fn div<T>(lhs: &PrimitiveArray<T>, rhs: &PrimitiveArray<T>) -> Result<PrimitiveArray<T>>
where
    T: NativeType + Div<Output = T>,
{
    check_same_type(lhs, rhs)?;
    if rhs.null_count() == 0 {
        binary(lhs, rhs, lhs.data_type().clone(), |a, b| a / b)
    } else {
        check_same_len(lhs, rhs)?;
        let values = lhs.iter().zip(rhs.iter()).map(|(l, r)| match (l, r) {
            (Some(l), Some(r)) => Some(*l / *r),
            _ => None,
        });
        Ok(PrimitiveArray::from_trusted_len_iter(values).to(lhs.data_type().clone()))
    }
}
pub fn div < T > ( lhs : & PrimitiveArray < T > , rhs : & PrimitiveArray < T > ) -> Result < PrimitiveArray < T > > where T : NativeType + Div < Output = T > , { check_same_type ( lhs , rhs ) ? ; if rhs . null_count ( ) == 0 { binary ( lhs , rhs , lhs . data_type ( ) . clone ( ) , | a , b | a / b ) } else { check_same_len ( lhs , rhs ) ? ; let values = lhs . iter ( ) . zip ( rhs . iter ( ) ) . map ( | ( l , r ) | match ( l , r ) { ( Some ( l ) , Some ( r ) ) => Some ( * l / * r ) , _ => None , } ) ; Ok ( PrimitiveArray :: from_trusted_len_iter ( values ) . to ( lhs . data_type ( ) . clone ( ) ) ) } }
Divides two primitive arrays with the same type.
Divides two primitive arrays with the same type .
lhs
&PrimitiveArray<T>
rhs
&PrimitiveArray<T>
lhs
&PrimitiveArray<T>
rhs
&PrimitiveArray<T>
examples
```
use arrow2::compute::arithmetics::basic::div;
use arrow2::array::Int32Array.


` ` ` use arrow2 :: compute :: arithmetics :: basic :: div ; use arrow2 :: array :: Int32Array .