Cloud Stack Ninja

Sorry for horrible title, DF diagrams below should help!

I have two data frames. The 'code' is the same on each data frame. So the DF0 data frame has exactly 3x the length of DF1. I need to create a new DF, lets call it DF2, as shown below. Please let me know if this is still not clear!

DF0
Code Column1 Column2                   
1    Data    Data
1    Data    Data
1    Data    Data
2    Data    Data
2    Data    Data
3    Data    Data
3    Data    Data
3    Data    Data


DF1
Code Column3 Column4                   
1      x        x
2      y        y
3      z        z

DF2
Code Column1 Column2  Column3 Column4                 
1    Data    Data      x        x
1    Data    Data      x        x
1    Data    Data      x        x
2    Data    Data      y        y
2    Data    Data      y        y
2    Data    Data      y        y


Read more here: https://stackoverflow.com/questions/64419080/join-dfs-on-non-unique-value

Content Attribution

This content was originally published by Ben Wallace at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: