I have a pandas dataframe which looks like the matrix below with row and column labels:
data=pd.DataFrame(np.array([[1,1,3],[2,1,4],[2,3,0.8]]),columns=['d','e','f'],index=['a','b','c'])
I would like to convert it to a proper dataframe which looks like this:
output=pd.DataFrame(np.array([[1,1,1,0.8]]),columns=['values'],index=['a-d','a-e','b-e','c-f'])
I tried using pd.melt but it just converts the column labels to row labels without merging them with the existing row labels. Is there a function or a way to achieve my goal in python?

