(self, arr, lengths)
| 2456 | return records |
| 2457 | |
| 2458 | def _validate_chunks(self, arr, lengths): |
| 2459 | from collections.abc import Sequence |
| 2460 | |
| 2461 | from dask.array.core import normalize_chunks |
| 2462 | |
| 2463 | if isinstance(lengths, Sequence): |
| 2464 | lengths = tuple(lengths) |
| 2465 | |
| 2466 | if len(lengths) != self.npartitions: |
| 2467 | raise ValueError( |
| 2468 | "The number of items in 'lengths' does not match the number of " |
| 2469 | f"partitions. {len(lengths)} != {self.npartitions}" |
| 2470 | ) |
| 2471 | |
| 2472 | if self.ndim == 1: |
| 2473 | chunks = normalize_chunks((lengths,)) |
| 2474 | else: |
| 2475 | chunks = normalize_chunks((lengths, (len(self.columns),))) |
| 2476 | |
| 2477 | return chunks |
| 2478 | elif lengths is not None: |
| 2479 | raise ValueError(f"Unexpected value for 'lengths': '{lengths}'") |
| 2480 | |
| 2481 | return arr._chunks |
| 2482 | |
| 2483 | def to_bag(self, index=False, format="tuple"): |
| 2484 | """Create a Dask Bag from a Series""" |
no test coverage detected