The task for the i'th partition Parameters ---------- index: The index of the partition of this dataframe Examples -------- >>> class Add(Expr): ... def _task(self, i): ... return Task( ... s
(self, key: Key, index: int)
| 238 | return [operand for operand in self.operands if isinstance(operand, Expr)] |
| 239 | |
| 240 | def _task(self, key: Key, index: int) -> Task: |
| 241 | """The task for the i'th partition |
| 242 | |
| 243 | Parameters |
| 244 | ---------- |
| 245 | index: |
| 246 | The index of the partition of this dataframe |
| 247 | |
| 248 | Examples |
| 249 | -------- |
| 250 | >>> class Add(Expr): |
| 251 | ... def _task(self, i): |
| 252 | ... return Task( |
| 253 | ... self.__dask_keys__()[i], |
| 254 | ... operator.add, |
| 255 | ... TaskRef((self.left._name, i)), |
| 256 | ... TaskRef((self.right._name, i)) |
| 257 | ... ) |
| 258 | |
| 259 | Returns |
| 260 | ------- |
| 261 | task: |
| 262 | The Dask task to compute this partition |
| 263 | |
| 264 | See Also |
| 265 | -------- |
| 266 | Expr._layer |
| 267 | """ |
| 268 | raise NotImplementedError( |
| 269 | "Expressions should define either _layer (full dictionary) or _task" |
| 270 | f" (single task). This expression {type(self)} defines neither" |
| 271 | ) |
| 272 | |
| 273 | def _layer(self) -> dict: |
| 274 | """The graph layer added by this expression. |