Example #1
0
 def pyarrow_meth(data, skipna, **kwargs):
     numerator = pc.stddev(data, skip_nulls=skipna, **kwargs)
     denominator = pc.sqrt_checked(
         pc.subtract_checked(
             pc.count(self._data, skip_nulls=skipna),
             kwargs["ddof"]))
     return pc.divide_checked(numerator, denominator)
Example #2
0
def binary_col(op, l, r):
    """
  interpretor for executing binary operator expressions
  """
    if op == "+": return compute.add_checked(l, r)
    if op == "*": return compute.multiply_checked(l, r)
    if op == '-': return compute.subtract_checked(l, r)
    if op == "=": return compute.equal(l, r)
    if op == "<>": return compute.not_equal(l, r)
    if op == "!=": return compute.not_equal(l, r)
    if op == "or": return compute.or_(l, r)
    if op == "<": return compute.less(l, r)
    if op == ">": return compute.greater(l, r)
    if op == "/": return compute.divide_checked(l, r)
    if op == "and": return compute.and_(l, r)
    if op == "in": return compute.is_in(l, r)
    if op == "==": return compute.equal(l, r)
    if op == "<=": return compute.less_equal(l, r)
    if op == ">=": return compute.greater_equal(l, r)
    raise Exception("binary op not implemented")
Example #3
0
        result = pc.floor(pc.divide_checked(left, right))
        if pa.types.is_integer(left.type) and pa.types.is_integer(right.type):
            result = result.cast(left.type)
        return result

    ARROW_ARITHMETIC_FUNCS = {
        "add":
        NotImplemented if pa_version_under2p0 else pc.add_checked,
        "radd":
        NotImplemented
        if pa_version_under2p0 else lambda x, y: pc.add_checked(y, x),
        "sub":
        NotImplemented if pa_version_under2p0 else pc.subtract_checked,
        "rsub":
        NotImplemented
        if pa_version_under2p0 else lambda x, y: pc.subtract_checked(y, x),
        "mul":
        NotImplemented if pa_version_under2p0 else pc.multiply_checked,
        "rmul":
        NotImplemented
        if pa_version_under2p0 else lambda x, y: pc.multiply_checked(y, x),
        "truediv":
        NotImplemented if pa_version_under2p0 else
        lambda x, y: pc.divide_checked(cast_for_truediv(x, y), y),
        "rtruediv":
        NotImplemented if pa_version_under2p0 else
        lambda x, y: pc.divide_checked(y, cast_for_truediv(x, y)),
        "floordiv":
        NotImplemented
        if pa_version_under2p0 else lambda x, y: floordiv_compat(x, y),
        "rfloordiv":