Add as_frame='auto' option in datasets.fetch_openml#17396
Merged
rth merged 5 commits intoscikit-learn:masterfrom Jun 10, 2020
Merged
Add as_frame='auto' option in datasets.fetch_openml#17396rth merged 5 commits intoscikit-learn:masterfrom
rth merged 5 commits intoscikit-learn:masterfrom
Conversation
Contributor
Author
|
ping |
rth
reviewed
Jun 9, 2020
Member
rth
left a comment
There was a problem hiding this comment.
Sounds good to me aside from a few comments below. I would also be +1 to make "auto" the default since fetch_openml is experimental.
| data. If ``return_X_y`` is True, then ``(data, target)`` will be pandas | ||
| DataFrames or Series as describe above. | ||
| If as_frame is 'auto', the data and target will be converted to | ||
| DataFrame or Series as if as_frame is set to True, unless the dataset |
Contributor
Author
There was a problem hiding this comment.
data.target may be a Series. For example:
data_id = 61 # iris dataset version 1
data = fetch_openml(data_id=data_id, as_frame=True)
>>> type(data.target)
<class 'pandas.core.series.Series'>Co-authored-by: Roman Yurchak <rth.yurchak@gmail.com>
rth
approved these changes
Jun 9, 2020
Member
rth
left a comment
There was a problem hiding this comment.
Thanks!
I would also be +1 to make "auto" the default since fetch_openml is experimental.
Let's see what other reviewers think about doing that.
Member
|
I'm okay with making it default. If the occasional user needs to change
their code to add .values, so be it.
|
Member
|
Could you propose that change to default in another pull request? |
Contributor
Author
|
Sure. Do you want to merge this first? Or do I branch out from here? |
Member
|
Thanks! Please open a new PR for changing the default. |
viclafargue
pushed a commit
to viclafargue/scikit-learn
that referenced
this pull request
Jun 26, 2020
jayzed82
pushed a commit
to jayzed82/scikit-learn
that referenced
this pull request
Oct 22, 2020
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/PRs
Closes #14888
What does this implement/fix? Explain your changes.
This PR adds an
'auto'option for argumentas_framein functiondatasets.fetch_openml.When
as_frameis set to be'auto', returned data will be converted to pandas DataFrame or Series unless data is sparse.Any other comments?
This PR doesn't fully close #14888. The team still need to discuss and decide whether to make
'auto'the default option.