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

Function _get_meta_ufunc

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

Source from the content-addressed store, hash-verified

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