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

Function _wrap_expr_op

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

Source from the content-addressed store, hash-verified

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