コード例 #1
0
def coalesce(*args):
    """
    Compute the first non-null value(s) from the passed arguments in
    left-to-right order. This is also known as "combine_first" in pandas.

    Parameters
    ----------
    *args : variable-length value list

    Examples
    --------
    result = coalesce(expr1, expr2, 5)

    Returns
    -------
    coalesced : type of first provided argument
    """
    return _ops.Coalesce(*args).to_expr()
コード例 #2
0
ファイル: generic.py プロジェクト: ibis-project/ibis
    def coalesce(self, *args: Value) -> Value:
        """Return the first non-null value from `args`.

        Parameters
        ----------
        args
            Arguments from which to choose the first non-null value

        Returns
        -------
        Value
            Coalesced expression

        Examples
        --------
        >>> import ibis
        >>> expr1 = None
        >>> expr2 = 4
        >>> result = ibis.coalesce(expr1, expr2, 5)
        """
        import ibis.expr.operations as ops

        return ops.Coalesce([self, *args]).to_expr()