Extraction of a common column pandas

Viewed 38

I have two data frames, I need to extract data in Column_3 of the second dataframe DF2.

Question 1: How should I create "Column_3" from "Column_1" and "Column_2" of the first dataframe?

DF1 =

Column_1           Column_2          Column_3
Red Apple           small          Red Apple small
Green fruit         Large          Green fruit Large
Yellow Banana       Medium         Yellow Banana Medium
Pink Mango          Tiny           Pink Mango Tiny

Question 2: I need to extract "n_col3" from n_col1 & n_col2 but that should be similar to the column_3 of data frame 1. (see the brackets for info of what to be extracted)

Note: If all the information of Column_3 is not available in Column_1 & Column_2 like in Row 1 & Row 3, Only that information that is available should be extracted)

DF2 =

  n_col1                     n_col2                    n_col3
L854 fruit Charlie      Green LTD Large      fruit Large(Green missing Fruit Large extracted)
Red alpha 8 small       Tango G250 Apple     Red Apple small(all information extracted)
Mk43 Mango Beta         Tiny J448 T          Mango Tiny(Pink missing, Mango Tiny is extracted)
M40 Yellow Medium       Romeo Banana         Yellow Banana Medium(all information extracted)

I want to extract that column so that I can do further processing of merging. Can anyone help me with this. Thank you in advance.

0 Answers
Related