Skip to content

Commit

Permalink
Fix floating point imprecision with np.timedelta64
Browse files Browse the repository at this point in the history
  • Loading branch information
agriyakhetarpal committed Mar 5, 2024
1 parent f049ac2 commit 4d4c017
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pandas/tests/io/sas/test_sas7bdat.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import numpy as np
import pytest

from pandas.compat import IS64
from pandas.compat import IS64, WASM
from pandas.errors import EmptyDataError

import pandas as pd
Expand Down Expand Up @@ -190,7 +190,7 @@ def test_date_time(datapath):
res = df0["DateTimeHi"].astype("M8[us]").dt.round("ms")
df0["DateTimeHi"] = res.astype("M8[ms]")

if not IS64:
if (not IS64) or (WASM):
# No good reason for this, just what we get on the CI
df0.loc[0, "DateTimeHi"] += np.timedelta64(1, "ms")
df0.loc[[2, 3], "DateTimeHi"] -= np.timedelta64(1, "ms")
Expand Down Expand Up @@ -285,7 +285,7 @@ def test_max_sas_date(datapath):
columns=["text", "dt_as_float", "dt_as_dt", "date_as_float", "date_as_date"],
)

if not IS64:
if (not IS64) or (WASM):
# No good reason for this, just what we get on the CI
expected.loc[:, "dt_as_dt"] -= np.timedelta64(1, "ms")

Expand Down Expand Up @@ -328,7 +328,7 @@ def test_max_sas_date_iterator(datapath):
columns=col_order,
),
]
if not IS64:
if (not IS64) or (WASM):
# No good reason for this, just what we get on the CI
expected[0].loc[0, "dt_as_dt"] -= np.timedelta64(1, "ms")
expected[1].loc[0, "dt_as_dt"] -= np.timedelta64(1, "ms")
Expand Down Expand Up @@ -359,7 +359,7 @@ def test_null_date(datapath):
),
},
)
if not IS64:
if (not IS64) or (WASM):
# No good reason for this, just what we get on the CI
expected.loc[0, "datetimecol"] -= np.timedelta64(1, "ms")
tm.assert_frame_equal(df, expected)
Expand Down

0 comments on commit 4d4c017

Please sign in to comment.