I try to do a "excel v lookup" to merge 2 df based on a value. If the 1,st value is in  the second then merge(see ex below). I tried many options here but no one works. I try to put the dates on corresponding numbers from column WO_ID and keep all numbers from this column.
I know how to transform string in dates but I let * and A maybe you can write complete code.
So:
Data Frame 1: cms
WO_ID          Status
14163-2018  1
14142-2018  1
2092-2019   2
2093-2019   2
11922-2019  1
Data Frame 2: df
WO                    Start     Finish
2092-2019; 2093-2019      12-07-19* 18-07-19
11922-2019            02-07-2019A   28-07-19*
14142-2018; 14163-2018    06-07-19  28-07-19*
Beside many other codes tried, I think this is more close to result...but obviously does not work.
I try to create a 3rd db that contain merged cms+db (let's call it "all")
This is the code:
all = pd.merge(cms,df,left_on='WO_ID',right_on='WO',how='left',indicator=True)
This is the result that obviously is not complete:
WO_ID         Statu     WO      Start         Finish        _merge
14163-2018  1   NaN     NaT           NaT          left_only
14142-2018  1   NaN     NaT           NaT          left_only
2092-2019   2   NaN     NaT       NaT          left_only
2093-2019   2   NaN     NaT       NaT          left_only
11922-2019  1   11922-2019  02-07-2019A   28-07-19* both
I try to obtain output like this:
WO_ID        Status  WO                      Start    Finish    _merge
14163-2018  1    14142-2018; 14163-2018  06-07-19    28-07-19* whatever..
14142-2018  1    14142-2018; 14163-2018  06-07-19    28-07-19* whatever..
2092-2019   2    2092-2019; 2093-2019    12-07-19*   18-07-19  whatever..
2093-2019   2    2092-2019; 2093-2019    12-07-19*   18-07-19  whatever..
11922-2019  1    11922-2019              02-07-2019A 28-07-19* both
But I don't know how.
 
     
    



 
    