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

Series.hist with bin_count produces wrong result if all values are the same #20030

Closed
2 tasks done
coastalwhite opened this issue Nov 27, 2024 · 1 comment · Fixed by #20034
Closed
2 tasks done

Series.hist with bin_count produces wrong result if all values are the same #20030

coastalwhite opened this issue Nov 27, 2024 · 1 comment · Fixed by #20034
Labels
bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars

Comments

@coastalwhite
Copy link
Collaborator

coastalwhite commented Nov 27, 2024

Checks

  • I have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest version of Polars.

Reproducible example

pl.Series([1, 1]).hist(bin_count=2)
shape: (2, 3)
┌────────────┬────────────┬───────┐
│ breakpoint ┆ category   ┆ count │
│ ---        ┆ ---        ┆ ---   │
│ f64        ┆ cat        ┆ u32   │
╞════════════╪════════════╪═══════╡
│ 1.0        ┆ (1.0, 1.0] ┆ 2     │
│ 1.0        ┆ (1.0, 1.0] ┆ 0     │
└────────────┴────────────┴───────┘

Log output

No response

Issue description

The output is incorrect.

This also causes a flaky failure of tests/unit/operations/test_hist.py::test_hist_rand.

Expected behavior

Correct output.

Installed versions

Replace this line with the output of pl.show_versions(). Leave the backticks in place.
@coastalwhite coastalwhite added bug Something isn't working python Related to Python Polars needs triage Awaiting prioritization by a maintainer labels Nov 27, 2024
@mcrumiller
Copy link
Contributor

Thanks @coastalwhite, I updated hist recently so this is my fault. This is a quick fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants