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

Function _get_meta_ufunc

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

Source from the content-addressed store, hash-verified

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