Skip to content

Commit

Permalink
Use x.min() and x.max() rather than .any to fix OverflowError
Browse files Browse the repository at this point in the history
  • Loading branch information
mwouts committed Aug 18, 2023
1 parent e7dbb19 commit 1091932
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions itables/datatables_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ def convert_bigints_to_str(df, warn_on_int_to_str_conversion):
df.iloc[:, i] = x.astype(str)
converted.append(col)
except AttributeError:
# Polars
x = df[col]
if (
x.dtype in pl.INTEGER_DTYPES
and ((x < JS_MIN_SAFE_INTEGER) | (x > JS_MAX_SAFE_INTEGER)).any()
if x.dtype in pl.INTEGER_DTYPES and (
(x.min() < JS_MIN_SAFE_INTEGER) or (x.max() > JS_MAX_SAFE_INTEGER)
):
df = df.with_columns(pl.col(col).cast(pl.Utf8))
converted.append(col)
Expand Down

0 comments on commit 1091932

Please sign in to comment.