MCPcopy
hub / github.com/dask/dask / _wrap_expr_op

Function _wrap_expr_op

dask/dataframe/dask_expr/_collection.py:172–194  ·  view source on GitHub ↗
(self, other, op=None)

Source from the content-addressed store, hash-verified

170
171
172def _wrap_expr_op(self, other, op=None):
173 # Wrap expr operator
174 assert op is not None
175 if isinstance(other, FrameBase):
176 other = other.expr
177 elif isinstance(other, da.Array):
178 other = from_dask_array(other, index=self.index, columns=self.columns)
179 if self.ndim == 1 and len(self.columns):
180 other = other[self.columns[0]]
181
182 if (
183 not isinstance(other, expr.Expr)
184 and is_dataframe_like(other)
185 or is_series_like(other)
186 ):
187 other = self._create_alignable_frame(other).expr
188
189 if not isinstance(other, expr.Expr):
190 return new_collection(getattr(self.expr, op)(other))
191 elif expr.are_co_aligned(self.expr, other):
192 return new_collection(getattr(self.expr, op)(other))
193 else:
194 return new_collection(expr.OpAlignPartitions(self, other, op))
195
196
197def _wrap_expr_method_operator(name, class_):

Callers

nothing calls this directly

Calls 5

from_dask_arrayFunction · 0.90
new_collectionFunction · 0.90
is_dataframe_likeFunction · 0.85
is_series_likeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…