@@ -1201,23 +1201,27 @@ def _maybe_coerce_merge_keys(self) -> None:
1201
1201
1202
1202
# check whether ints and floats
1203
1203
elif is_integer_dtype (rk .dtype ) and is_float_dtype (lk .dtype ):
1204
- if not (lk == lk .astype (rk .dtype ))[~ np .isnan (lk )].all ():
1205
- warnings .warn (
1206
- "You are merging on int and float "
1207
- "columns where the float values "
1208
- "are not equal to their int representation." ,
1209
- UserWarning ,
1210
- )
1204
+ # GH 47391 numpy > 1.24 will raise a RuntimeError for nan -> int
1205
+ with np .errstate (invalid = "ignore" ):
1206
+ if not (lk == lk .astype (rk .dtype ))[~ np .isnan (lk )].all ():
1207
+ warnings .warn (
1208
+ "You are merging on int and float "
1209
+ "columns where the float values "
1210
+ "are not equal to their int representation." ,
1211
+ UserWarning ,
1212
+ )
1211
1213
continue
1212
1214
1213
1215
elif is_float_dtype (rk .dtype ) and is_integer_dtype (lk .dtype ):
1214
- if not (rk == rk .astype (lk .dtype ))[~ np .isnan (rk )].all ():
1215
- warnings .warn (
1216
- "You are merging on int and float "
1217
- "columns where the float values "
1218
- "are not equal to their int representation." ,
1219
- UserWarning ,
1220
- )
1216
+ # GH 47391 numpy > 1.24 will raise a RuntimeError for nan -> int
1217
+ with np .errstate (invalid = "ignore" ):
1218
+ if not (rk == rk .astype (lk .dtype ))[~ np .isnan (rk )].all ():
1219
+ warnings .warn (
1220
+ "You are merging on int and float "
1221
+ "columns where the float values "
1222
+ "are not equal to their int representation." ,
1223
+ UserWarning ,
1224
+ )
1221
1225
continue
1222
1226
1223
1227
# let's infer and see if we are ok
0 commit comments