File tree 1 file changed +16
-3
lines changed
1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -914,16 +914,29 @@ def _maybe_coerce_merge_keys(self):
914
914
continue
915
915
916
916
# check whether ints and floats
917
- if is_integer_dtype (rk ) and is_float_dtype (lk ):
917
+ elif is_integer_dtype (rk ) and is_float_dtype (lk ):
918
+ if not (lk == lk .astype (rk .dtype )).all ():
919
+ warnings .warn ('You are merging on int and float '
920
+ 'columns where the float values '
921
+ 'are not equal to their int '
922
+ 'representation' , UserWarning )
918
923
continue
919
924
920
- if is_float_dtype (rk ) and is_integer_dtype (lk ):
925
+ elif is_float_dtype (rk ) and is_integer_dtype (lk ):
926
+ if not (rk == rk .astype (lk .dtype )).all ():
927
+ warnings .warn ('You are merging on int and float '
928
+ 'columns where the float values '
929
+ 'are not equal to their int '
930
+ 'representation' , UserWarning )
921
931
continue
922
932
923
933
# let's infer and see if we are ok
924
- if lib .infer_dtype (lk ) == lib .infer_dtype (rk ):
934
+ elif lib .infer_dtype (lk ) == lib .infer_dtype (rk ):
925
935
continue
926
936
937
+ else :
938
+ pass
939
+
927
940
# Houston, we have a problem!
928
941
# let's coerce to object if the dtypes aren't
929
942
# categorical, otherwise coerce to the category
You can’t perform that action at this time.
0 commit comments