Having pandas 0.19.2.
Here is an example:
testdf = pd.DataFrame({'A': [1, 2, 3, 4], 'B': [1.0, 2.0, 3.0, 4.0]})
testdf.dtypes
Conclusion:
A int64
B float64
dtype: object
Now everything looks great, but I don’t like that (first call - pd.Series.ilocand second - pd.DataFrame.iloc)
print(type(testdf.A.iloc[0]))
print(type(testdf.iloc[0].A))
Conclusion:
<class 'numpy.int64'>
<class 'numpy.float64'>
I found it, trying to understand why the operation pd.DataFrame.join()almost does not intersect with two columns int64, although there should be a lot of them. I assume that due to the inconsistency of types that may be associated with this behavior, but I'm not sure ... My short investigation showed above, and now I'm a little confused.
If someone knows how to solve it, I will be very grateful for any tips!
UPD
Thanks to @EdChum for comments. So here is an example with my generated data and combining / combining behavior
testdf.join(testdf, on='A', rsuffix='3')
A B A3 B3
0 1 1.0 2.0 2.0
1 2 2.0 3.0 3.0
2 3 3.0 4.0 4.0
3 4 4.0 NaN NaN
And what is considered exactly the same
pd.merge(left=testdf, right=testdf, on='A')
returns
A B_x B_y
0 1 1.0 1.0
1 2 2.0 2.0
2 3 3.0 3.0
3 4 4.0 4.0
UPD2 @EdChum join merge. , A.join(B, on='C') A B['C'], join . , .