Validates that all usecols are present in a given list of names. If not, raise a ValueError that shows what usecols are missing. Parameters ---------- usecols : iterable of usecols The columns to validate are present in names. nam
(self, usecols: SequenceT, names: Sequence)
| 636 | |
| 637 | @final |
| 638 | def _validate_usecols_names(self, usecols: SequenceT, names: Sequence) -> SequenceT: |
| 639 | """ |
| 640 | Validates that all usecols are present in a given |
| 641 | list of names. If not, raise a ValueError that |
| 642 | shows what usecols are missing. |
| 643 | |
| 644 | Parameters |
| 645 | ---------- |
| 646 | usecols : iterable of usecols |
| 647 | The columns to validate are present in names. |
| 648 | names : iterable of names |
| 649 | The column names to check against. |
| 650 | |
| 651 | Returns |
| 652 | ------- |
| 653 | usecols : iterable of usecols |
| 654 | The `usecols` parameter if the validation succeeds. |
| 655 | |
| 656 | Raises |
| 657 | ------ |
| 658 | ValueError : Columns were missing. Error message will list them. |
| 659 | """ |
| 660 | missing = [c for c in usecols if c not in names] |
| 661 | if len(missing) > 0: |
| 662 | raise ValueError( |
| 663 | f"Usecols do not match columns, columns expected but not found: " |
| 664 | f"{missing}" |
| 665 | ) |
| 666 | |
| 667 | return usecols |
| 668 | |
| 669 | @final |
| 670 | def _clean_index_names(self, columns, index_col) -> tuple[list | None, list, list]: |
no outgoing calls
no test coverage detected