2

I have a pd.Dataframe that contains the following:

student_id,course_id,mark

another dataframe contains:

date,student_id,course_id

I want to perform a "join" on both of the data in a such way that my resulting dataframe would contain:

date,student_id,course_id,mark

but I also do want it to be joined based on the double key (student_id,course_id) which is going to be unique in my dataframe.

How can I perform this?

Thanks a lot in advance.

1

1 Answer 1

1

sorry my bad, the answer was in the doc

result = pd.merge(left, right, how='left', on=['key1', 'key2'])

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.