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