Skip to content

LabelBinarizer returns dense output when input has only a single label even when sparse_output is set to True #6202

@MechCoder

Description

@MechCoder
lb = LabelBinarizer(sparse_output=True)
y = [1, 1, 1, 1, 1]
lb.fit_transform(y)
array([[0],
   [0],
   [0],
   [0],
   [0]])

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions