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