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

Function _wrap_expr_op

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

Source from the content-addressed store, hash-verified

178
179
180def _wrap_expr_op(self, other, op=None):
181 # Wrap expr operator
182 assert op is not None
183 if isinstance(other, FrameBase):
184 other = other.expr
185 elif isinstance(other, da.Array):
186 other = from_dask_array(other, index=self.index, columns=self.columns)
187 if self.ndim == 1 and len(self.columns):
188 other = other[self.columns[0]]
189
190 if (
191 not isinstance(other, expr.Expr)
192 and is_dataframe_like(other)
193 or is_series_like(other)
194 ):
195 other = self._create_alignable_frame(other).expr
196
197 if not isinstance(other, expr.Expr):
198 return new_collection(getattr(self.expr, op)(other))
199 elif expr.are_co_aligned(self.expr, other):
200 return new_collection(getattr(self.expr, op)(other))
201 else:
202 return new_collection(expr.OpAlignPartitions(self, other, op))
203
204
205def _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