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

Function _wrap_expr_op

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

Source from the content-addressed store, hash-verified

164
165
166def _wrap_expr_op(self, other, op=None):
167 # Wrap expr operator
168 assert op is not None
169 if isinstance(other, FrameBase):
170 other = other.expr
171 elif isinstance(other, da.Array):
172 other = from_dask_array(other, index=self.index, columns=self.columns)
173 if self.ndim == 1 and len(self.columns):
174 other = other[self.columns[0]]
175
176 if (
177 not isinstance(other, expr.Expr)
178 and is_dataframe_like(other)
179 or is_series_like(other)
180 ):
181 other = self._create_alignable_frame(other).expr
182
183 if not isinstance(other, expr.Expr):
184 return new_collection(getattr(self.expr, op)(other))
185 elif expr.are_co_aligned(self.expr, other):
186 return new_collection(getattr(self.expr, op)(other))
187 else:
188 return new_collection(expr.OpAlignPartitions(self, other, op))
189
190
191def _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