I am trying to do a simple merge between two data files. They come from two different SQL tables, where the joining keys are rows:
>>> df1.col1.dtype
dtype('O')
>>> df2.col2.dtype
dtype('O')
I am trying to combine them using this:
>>> merge_res = pd.merge(df1, df2, left_on='col1', right_on='col2')
The result of the inner join is empty, and this first told me that there might not be any entries at the intersection:
>>> merge_res.shape
(0, 19)
But when I try to match one element, I see this really strange behavior.
>>> df2.iloc[5,:].col2
'95498208100000'
>>> df1[df1.col1 == '95498208100000']
0 rows × 19 columns
>>> df1[df1.col1 == 95498208100000]
1 rows × 19 columns
So the columns are defined with the type 'object'. Searching for them as strings does not produce any results. Searching for them as integers returns the result, and I think that is the reason why merging does not work above.
Any ideas what is going on?
, Pandas df1.col1 , , .
( , , . , , .)