I have two dataframes:
Frame A:
OB_ID CA_ID col1 col2 col3
4 4 a b c
4 4 a d b
3 5 c c e
this dataframe is very large and I am not sure about all the IDs in it.
Frame B:
OB_ID CA_ID colZ
1 1 sky
4 4 fire
4 3 data
I want to add the colZ to frame A only if OB_ID and CA_ID matches, otherwise add Nan/NUll in that palce, resulting dataframe to look like this:
OB_ID CA_ID col1 col2 col3 colz
4 4 a b c fire
4 4 a d b fire
3 5 c c e NA/unknown
The shape of Frame A is 8666515 rows × 3 columns, and for B is 367469 rows × 342 columns, but when I do
df3 = pd.merge(frameA, frameB, on=['OB_ID','CA_ID'], how='left')
df3.shape
it gives shape: 1490420 rows × 343 columns, but I dnt understand why the number of rows grow from 367469 to 1490420 .