Skip to content

Inconsistent return type in statistics.median_grouped() #92531

@rhettinger

Description

@rhettinger

The median_grouped() function erroneously returns inconsistent types in its special case path for a single argument. The function should always return a float.

>>> median_grouped([Fraction(2, 3), Fraction(3, 5)]) 0.16666666666666663 >>>median_grouped([Fraction(2, 3)]) Fraction(2, 3) >>> median_grouped([Decimal(5.5), Decimal(2.5)]) 5.0 >>> median_grouped([Decimal(5.5)]) Decimal('5.5') 

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.11only security fixestype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions