Got Input df1 and df2
df1:
Subcategory_Desc Segment_Desc Flow Side Row_no
APPLE APPLE LOOSE Apple Kanzi Front Row 1
APPLE APPLE LOOSE Apple Jazz Front Row 1
CITRUS ORANGES LOOSE Orange Navel Front Row 1
PEAR PEARS LOOSE Lemon Right End Row 1
AVOCADOS AVOCADOS LOOSE Avocado Back Row 1
TROPICAL FRUIT KIWI FRUIT Kiwi Gold Back Row 1
TROPICAL FRUIT KIWI FRUIT Kiwi Green Left End Row 1
df2:
Subcategory_Desc Segment_Desc Flow
TROPICAL FRUIT KIWI FRUIT 5pk Kids Kiwi
APPLE APPLE LOOSE Apple GoldenDel
AVOCADOS AVOCADOS LOOSE Avocado Tray
Scenario: Dataframe df2 rows should be inserted to dataframe df1 considering below condition:
- Check for the similar Subcategory_Desc and Segment_Desc of df2 in df1 and insert that df2 row at the end of that particular Side(Front/Back). As given in expected Output.
- Need to consider Row_no column as well, because original dataset holds n number of Row_no, here have given Row 1 alone for sample data.
Expected Output:
Subcategory_Desc Segment_Desc Flow Side Row_no
APPLE APPLE LOOSE Apple Kanzi Front Row 1
APPLE APPLE LOOSE Apple Jazz Front Row 1
CITRUS ORANGES LOOSE Orange Navel Front Row 1
APPLE APPLE LOOSE Apple GoldenDel Front Row 1
PEAR PEARS LOOSE Lemon Right End Row 1
AVOCADOS AVOCADOS LOOSE Avocado Back Row 1
TROPICAL FRUIT KIWI FRUIT Kiwi Gold Back Row 1
TROPICAL FRUIT KIWI FRUIT 5pk Kids Kiwi Back Row 1
AVOCADOS AVOCADOS LOOSE Avocado Tray Back Row 1
TROPICAL FRUIT KIWI FRUIT Kiwi Green Left End Row 1
Not sure what simple logic can be used for this purpose.