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

Method _simplify_down

dask/dataframe/dask_expr/_expr.py:2225–2245  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2223 return super()._divisions()
2224
2225 def _simplify_down(self):
2226 if (
2227 str(self.frame.columns) == str(self.columns)
2228 and self._meta.ndim == self.frame._meta.ndim
2229 ):
2230 # TODO: we should get more precise around Expr.columns types
2231 return self.frame
2232 if isinstance(self.frame, Projection):
2233 # df[a][b]
2234 a = self.frame.operand("columns")
2235 b = self.operand("columns")
2236
2237 if not isinstance(a, list):
2238 # df[scalar][b] -> First selection coerces to Series
2239 return
2240 elif isinstance(b, list):
2241 assert all(bb in a for bb in b)
2242 else:
2243 assert b in a
2244
2245 return self.frame.frame[b]
2246
2247
2248class Index(Elemwise):

Callers

nothing calls this directly

Calls 2

allFunction · 0.85
operandMethod · 0.80

Tested by

no test coverage detected