Skip to content

Q83 doesn't directly work for floats or sparse integers #225

@jeqcho

Description

@jeqcho

83. How to find the most frequent value in an array?

answer(83)
# Z = np.random.randint(0,10,50)
# print(np.bincount(Z).argmax())

If the array is made out of floats, this doesn't work. If the array is sparse but wide (e.g. [1e9,2e9,2e9]), then this is not efficient as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions