Skip to content

Commit 1dcaa63

Browse files
committed
BUG: (#28098) changes
1 parent 6ab8140 commit 1dcaa63

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

pandas/core/reshape/merge.py

+12-6
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,15 @@
3939
)
4040
from pandas.core.dtypes.missing import isnull, na_value_for_dtype
4141

42-
from pandas import Categorical, DataFrame, Index, MultiIndex, Series, Timedelta
42+
from pandas import (
43+
Categorical,
44+
DataFrame,
45+
Index,
46+
MultiIndex,
47+
Series,
48+
Timedelta,
49+
to_timedelta,
50+
)
4351
import pandas.core.algorithms as algos
4452
from pandas.core.arrays.categorical import _recode_for_categories
4553
import pandas.core.common as com
@@ -1706,11 +1714,9 @@ def flip(xs):
17061714
left_values = left_values.view("i8")
17071715
right_values = right_values.view("i8")
17081716
if tolerance is not None:
1709-
try:
1710-
tolerance = tolerance.value
1711-
except AttributeError:
1712-
# datetime.timedelta(microseconds=1) == min resolution, cvt to nano
1713-
tolerance = (tolerance / datetime.timedelta(microseconds=1)) * 1000
1717+
if not isinstance(self.tolerance, Timedelta):
1718+
tolerance = to_timedelta(tolerance)
1719+
tolerance = tolerance.value
17141720

17151721
# a "by" parameter requires special handling
17161722
if self.left_by is not None:

0 commit comments

Comments
 (0)