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