-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Added the round( ) function to avoid error while multiplication of float numbers issue: #46362 #46388
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
Added the round( ) function to avoid error while multiplication of float numbers issue: #46362 #46388
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -362,6 +362,7 @@ Conversion | |
- Bug in :meth:`Series.astype` and :meth:`DataFrame.astype` from floating dtype to unsigned integer dtype failing to raise in the presence of negative values (:issue:`45151`) | ||
- Bug in :func:`array` with ``FloatingDtype`` and values containing float-castable strings incorrectly raising (:issue:`45424`) | ||
- Bug when comparing string and datetime64ns objects causing ``OverflowError`` exception. (:issue:`45506`) | ||
- Bug in :meth:`format.py` the percentiles values are converted to integer dtype, which ignores the floating point error while multiplying. (:issue:`46362`) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems a bit confusing. What about something more like "Bug when formatting percentiles, more decimals than needed shown" or something similar. |
||
|
||
Strings | ||
^^^^^^^ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3262,6 +3262,11 @@ def test_format_percentiles(): | |
expected = ["0%", "50%", "2.0%", "50%", "66.67%", "99.99%"] | ||
assert result == expected | ||
|
||
# Issue #46362 | ||
result = fmt.format_percentiles([0.281,0.57,0.58,0.29]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You need spaces after the commas. Also, those are supposed to be percentiles, so they should be sorted. |
||
expected = ['28.1%', '57%', '58%', '29%'] | ||
assert result == expected | ||
|
||
msg = r"percentiles should all be in the interval \[0,1\]" | ||
with pytest.raises(ValueError, match=msg): | ||
fmt.format_percentiles([0.1, np.nan, 0.5]) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you revert this please?