[BUG] Fix ValueError in _check_list_of_dict_table when encountering non-dict elements#779
Open
Kayd-06 wants to merge 1 commit intosktime:mainfrom
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reference Issues/PR
Fixes an undiscovered bug in _check_list_of_dict_table validation.
What does this implement/fix? Explain your changes.
Fixes a bug in
skpro.datatypes._table._check._check_list_of_dict_tablewhere a generator expression was incorrectly passed tonp.where().When invalid elements (non-dictionaries) were verified by this function, it attempted to return an error message containing their indices. By passing
not isinstance(x, dict) for x in objdirectly intonp.where(), it inadvertently caused aValueError: Calling nonzero on 0d arrays is not allowed.instead of returning the validation constraint violation.This commit replaces the faulty
np.where()generator with a standard list comprehension[i for i, x in enumerate(obj) if not isinstance(x, dict)]. This correctly formats the invalid indices into the error string and prevents the validation function itself from crashing.Does your contribution introduce a new dependency? If yes, which one?
No.
PR checklist
For all contributions
For new estimators
docs/source/api_reference/taskname.rst, follow the pattern.Examplessection.python_dependenciestag and ensureddependency isolation, see the estimator dependencies guide.