MCPcopy Create free account
hub / github.com/dask/dask / _get_meta_ufunc

Function _get_meta_ufunc

dask/dataframe/dask_expr/_expr.py:798–823  ·  view source on GitHub ↗
(dfs, args, func)

Source from the content-addressed store, hash-verified

796
797
798def _get_meta_ufunc(dfs, args, func):
799 dasks = [arg for arg in args if isinstance(arg, (Expr, Array))]
800
801 if len(dfs) >= 2 and not all(hasattr(d, "npartitions") for d in dasks):
802 # should not occur in current funcs
803 msg = "elemwise with 2 or more DataFrames and Scalar is not supported"
804 raise NotImplementedError(msg)
805 # For broadcastable series, use no rows.
806 parts = [
807 (
808 d._meta
809 if d.ndim == 0
810 else (
811 np.empty((), dtype=d.dtype)
812 if isinstance(d, Array)
813 else meta_nonempty(d._meta)
814 )
815 )
816 for d in dasks
817 ]
818
819 other = [
820 (i, arg) for i, arg in enumerate(args) if not isinstance(arg, (Expr, Array))
821 ]
822
823 return partial_by_order(*parts, function=func, other=other)
824
825
826class UFuncElemwise(MapPartitions):

Callers 2

_metaMethod · 0.85
_metaMethod · 0.85

Calls 3

partial_by_orderFunction · 0.90
allFunction · 0.85
emptyMethod · 0.45

Tested by

no test coverage detected