My main issue is a memory error each time I try to merge two of my data frames like this:
result = df1.merge(df2[['col1','col2','col3']], on=['col1','col2'], how='left')
So I need another way to add col3 to df1 (without getting a memory error).
I found solutions using map(). But the examples always had one column as key for a mapping:
result['col3'] = df1['col1'].map(df2.set_index('col1')['col3'])
but as mentioned before, the combination of two columns identifies a row within my data frame.
My questions:
- Could map be a solution for my problem?
- How can I use the function map() and consider col1 and col2?