Skip to content

BUG: Printing float16 with NumPy>=2.0 gives overflow warning #61029

Closed
@rhshadrach

Description

@rhshadrach
print(pd.Series([1.0], dtype="float16"))
# RuntimeWarning: overflow encountered in cast np.array([1.0], dtype="float16") > 1e6
# 0    1.0
# dtype: float16

This occurs here:

has_large_values = (abs_vals > 1e6).any()

Perhaps we just set has_large_values to be false for float16?

Metadata

Metadata

Labels

BugOutput-Formatting__repr__ of pandas objects, to_stringWarningsWarnings that appear or should be added to pandas

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions