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