Skip to content

FIX VisibleDeprecationWarning in unit tests and docstrings #18414

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 28, 2020

Conversation

OlehKSS
Copy link
Contributor

@OlehKSS OlehKSS commented Sep 16, 2020

Reference Issues/PRs

Related to #18367

What does this implement/fix? Explain your changes.

Fix numpy.VisibleDeprecationWarning in test_multilabel_binarizer_non_integer_labels, caused by an implicit conversion of a ragged nested sequence to numpy.ndarray.

Numpy's message:
numpy.VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray

Also, fix numpy.VisibleDeprecationWarning in the _to_object_array docstring tests.

@OlehKSS OlehKSS changed the title Fix VisibleDeprecationWarning in test_multilabel_binarizer_non_integer_labels Fix VisibleDeprecationWarning in unit tests and docstrings Sep 16, 2020
Copy link
Contributor

@cmarmo cmarmo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @OlehKSS for your PR. LGTM for me.
However, I'm wondering if the _to_object_array function is still necessary now that np.array ask for a dtype parameter. We might want to open an issue about that after this PR merged.

@cmarmo cmarmo added this to the 0.24 milestone Oct 20, 2020
@cmarmo
Copy link
Contributor

cmarmo commented Oct 20, 2020

Ping @glemaitre, if you have sometime to have a look. I think this is worth to have a place in 0.24 because it removes deprecations from numpy.

@glemaitre glemaitre changed the title Fix VisibleDeprecationWarning in unit tests and docstrings FIX VisibleDeprecationWarning in unit tests and docstrings Oct 28, 2020
@glemaitre glemaitre merged commit f9e0b7d into scikit-learn:master Oct 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants