Skip to content
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

stub for sklearn.datasets.load_iris is missing a return type option #345

Open
egerlach opened this issue Nov 12, 2024 · 0 comments
Open

Comments

@egerlach
Copy link

The Returns section of the docstring for sklearn.datasets.load_iris() has two options:

  1. An sklearn.utils.Bunch, if return_X_y is False
  2. A tuple[ndarray, ndarray] if return_X_y is True

The type stub for the function is

def load_iris(*, return_X_y: bool = False, as_frame: bool = False) -> tuple[Bunch, tuple]: ...

but I believe it should be:

def load_iris(*, return_X_y: bool = False, as_frame: bool = False) -> Bunch | tuple[ndarray, ndarray]: ...

or at least:

def load_iris(*, return_X_y: bool = False, as_frame: bool = False) -> Bunch | tuple: ...

which might be all we can get with parsing.

This might not be the only case of this in the codebase, but unfortunately I just have enough time to write this ticket. Normally I like to come with a bit more information, sorry about that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant