Hi, you should provide a reproducible example so that we can run your data. We don't know anything about df2 at the moment, so can't really help you.
df2
Also, if this is your homework, have a read: