Skip to content

REGR: .describe on unsigned dtypes results in object #48473

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

Merged
merged 7 commits into from
Sep 10, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Set via dtype
  • Loading branch information
rhshadrach committed Sep 10, 2022
commit ff4a95fe86e14938747fc1d96ec44f49878d8536
8 changes: 3 additions & 5 deletions pandas/core/describe.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,11 +241,9 @@ def describe_numeric_1d(series: Series, percentiles: Sequence[float]) -> Series:
+ [series.max()]
)

result = Series(d, index=stat_index, name=series.name)
if is_numeric_dtype(series):
# GH#48340 - don't rely on inference, always return float on numeric data
result = result.astype(float)
return result
# GH#48340 - don't rely on inference, always return float on numeric data
dtype = float if is_numeric_dtype(series) else None
return Series(d, index=stat_index, name=series.name, dtype=dtype)


def describe_categorical_1d(
Expand Down