-
-
Notifications
You must be signed in to change notification settings - Fork 18k
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
REGR: .describe on unsigned dtypes results in object #48473
Changes from 2 commits
d907794
97e6cdd
ff4a95f
60a9b6c
359cfd7
21b839d
3e3aa9f
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import numpy as np | ||
import pytest | ||
|
||
from pandas import ( | ||
Period, | ||
|
@@ -149,3 +150,25 @@ def test_datetime_is_numeric_includes_datetime(self): | |
index=["count", "mean", "min", "25%", "50%", "75%", "max"], | ||
) | ||
tm.assert_series_equal(result, expected) | ||
|
||
@pytest.mark.parametrize( | ||
"dtype", ["int32", "int64", "uint32", "uint64", "float32", "float64"] | ||
) | ||
def test_numeric_result_is_float(self, dtype): | ||
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. Maybe 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. Thanks - I also tried complex and found this was buggy in that case. Fixed and added all numeric dtypes. |
||
# GH#48340 - describe should always return dtype float on numeric input | ||
ser = Series([0, 1], dtype=dtype) | ||
result = ser.describe() | ||
expected = Series( | ||
[ | ||
2.0, | ||
0.5, | ||
ser.std(), | ||
0, | ||
0.25, | ||
0.5, | ||
0.75, | ||
1.0, | ||
], | ||
index=["count", "mean", "std", "min", "25%", "50%", "75%", "max"], | ||
) | ||
tm.assert_series_equal(result, expected) |
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.
Nit: Can we just set dtype=... when creating the Series?