I have two dataframes and I need to perform a smear (if that is what it’s generally called). Basically the first one is smaller (5 million rows) and the other is 40 million rows. I want to add the first value of dataframe 1 to the first 8 values of dataset 2, the second from dataframe 1 to the second set of 8 in dataframe 2 and so on.
For example:
Dataset 1:
Category | Value |
---|---|
1 | 3 |
2 | 5 |
3 | 7 |
Dataset 2:
Category | Value |
---|---|
1 | 6 |
1 | 3 |
1 | 7 |
2 | 2 |
2 | 8 |
2 | 1 |
3 | 4 |
3 | 0 |
3 | 9 |
And I want it to look like
Result:
Category | Value |
---|---|
1 | 9 |
1 | 6 |
1 | 10 |
2 | 7 |
2 | 13 |
2 | 6 |
3 | 11 |
3 | 7 |
3 | 16 |
Sorry, if my formatting isn’t very good, I’m not too used to SO and couldn’t a question to similar to mine.
I have attempted to use apply_smearing, but not sure if that is even what I should be, and it only resulted in errors. I’ll come back to update this post in a bit with the actual code I tried.