I have a dataframe like this:
Id Column Val1 Val2
0 Cust=abc,Region Info=xyz,Data=123 0.0 NaN
1 Cust=abd,Region Info=xyz,Data=124 1.0 750.0
2 Cust=acc hit,Data=125 3.0 400.0
3 Cust=abc,Region Info=xyz,Data=126 NaN 200.0
4 Cust=abg nss,Region Info=xaz,Data=127 -1.0 420.0
5 Cust=evc,Region Info=atz 2.0 NaN
I want to convert the dataframe to this:
Id Column Val1 Val2 Cust Region Info Data
0 Cust=abc,Region Info=xyz,Data=123 0.0 NaN abc xyz 123.0
1 Cust=abd,Region Info=xyz,Data=124 1.0 750.0 abd xyz 124.0
2 Cust=acc hit,Data=125 3.0 400.0 acc hit NaN 125.0
3 Cust=abc,Region Info=xyz,Data=126 NaN 200.0 abc xyz 126.0
4 Cust=abg nss,Region Info=xaz,Data=127 -1.0 420.0 abg nss xaz 127.0
5 Cust=evc,Region Info=atz 2.0 NaN evc atz NaN
From this other question, I got a partial answer.
But how can I handle the spaces in the key and value?
Edit: There may be multiple key-value pairs (other than the ones shown in the example). So I need to handle cases for any 'n' number of columns.