Q: Mapping time series from one df to another based on condition I have two dataframes...
The first df, df1, looks like this:
Name:    Category:      Date:       Value: 
Billy       Dog       2020-01-01      15
Bob         Cat       2020-01-01      20
Millie      Mouse     2020-01-01      20
Jim         Dog       2020-01-01      45
.....
.....
.....
Billy       Dog       2020-06-01      15
Bob         Cat       2020-06-01      20
Millie      Mouse     2020-06-01      20
Jim         Dog       2020-06-01      55


The second df, df2, looks like this:
Names:    Category:     01/01/2020:  .....  01/06/2020: 
Billy       Pig             50      .....      12
Bob         Cow             40      .....      20
Millie      Duck            25      .....      50


If the value in the 'Names' column in df2 matches the value in the 'Name' column in df1, I am trying to change the category in df1 to the respective category in df2, as well as replace the values. But if the name doesn't exist in df2, all of the values will remain the same in df1.
Example output:
Name:    Category:      Date:       Value: 
Billy       Pig       2020-01-01      50
Bob         Cow       2020-01-01      40
Millie      Duck     2020-01-01      25
Jim         Dog       2020-01-01      45
.....
.....
.....
Billy       Pig       2020-06-01      12
Bob         Cow       2020-06-01      20
Millie      Duck     2020-06-01      50
Jim         Dog       2020-06-01      55

Any help really appreciated.

A: Use DataFrame.melt for unpivot, then use left join in DataFrame.merge and last repalce not matched values NaNs:
df1['Date'] = pd.to_datetime(df1['Date'])

df = df2.melt(['Names','Category'], var_name='Date').rename(columns={'Names':'Name'})
df['Date'] = pd.to_datetime(df['Date'], dayfirst=True)


df3 = df1.merge(df, on=['Name','Date'], how='left', suffixes=('','_'))
df3['Category'] = df3.pop('Category_').combine_first(df3['Category'])
df3['Value'] = df3.pop('value').combine_first(df3['Value'])
df3 = df3.astype(df1.dtypes)
print (df3)
     Name Category       Date  Value
0   Billy      Pig 2020-01-01     50
1     Bob      Cow 2020-01-01     40
2  Millie     Duck 2020-01-01     25
3     Jim      Dog 2020-01-01     45
4   Billy      Pig 2020-06-01     12
5     Bob      Cow 2020-06-01     20
6  Millie     Duck 2020-06-01     50
7     Jim      Dog 2020-06-01     55

