Let's say I have a list of values,
lst=['orange','apple','banana', 'grape', 'lemon']
I also have a pandas dataframe of the form, df:
Source Destination Weight
orange apple 0.4
banana orange 0.67
grape lemon 0.1
grape banana 0.5
The rows are a subset of all pairwise combinations in lst. Note that every combination appears at most once.
What I want is a new dataframe where the remaining combinations are filled in with a value of 0.
For example, new_df:
Source Destination Weight
orange apple 0.4
banana orange 0.67
grape lemon 0.1
grape banana 0.5
orange grape 0.0
orange lemon 0.0
banana lemon 0.0
The order does not make a difference.
What is a fast way to do this?