(self, arr, lengths)
| 2496 | return records |
| 2497 | |
| 2498 | def _validate_chunks(self, arr, lengths): |
| 2499 | from collections.abc import Sequence |
| 2500 | |
| 2501 | from dask.array.core import normalize_chunks |
| 2502 | |
| 2503 | if isinstance(lengths, Sequence): |
| 2504 | lengths = tuple(lengths) |
| 2505 | |
| 2506 | if len(lengths) != self.npartitions: |
| 2507 | raise ValueError( |
| 2508 | "The number of items in 'lengths' does not match the number of " |
| 2509 | f"partitions. {len(lengths)} != {self.npartitions}" |
| 2510 | ) |
| 2511 | |
| 2512 | if self.ndim == 1: |
| 2513 | chunks = normalize_chunks((lengths,)) |
| 2514 | else: |
| 2515 | chunks = normalize_chunks((lengths, (len(self.columns),))) |
| 2516 | |
| 2517 | return chunks |
| 2518 | elif lengths is not None: |
| 2519 | raise ValueError(f"Unexpected value for 'lengths': '{lengths}'") |
| 2520 | |
| 2521 | return arr._chunks |
| 2522 | |
| 2523 | def to_bag(self, index=False, format="tuple"): |
| 2524 | """Create a Dask Bag from a Series""" |
no test coverage detected