I'd like to transform the following data frame, but can't seem to get the right function to do it. Any time I use 'melt', I am prompted to convert to an array, though an array does not seem to accept column names.
In any case, any help with turning this:
| A | B | C1 | C1.A | C2 | C2.A |
|---|---|---|---|---|---|
| PC | 11001 | Core | Old | SE | New |
Into this:
| A | B | C | C.A |
|---|---|---|---|
| PC | 11001 | Core | Old |
| PC | 11001 | SE | New |
Would be greatly appreciated.
Code for the first and second df's, respectively.
df1 = {'A': ['PC'], 'B': [11001],'C1':['Core'],'C1.A':['Old'],'C2':['SE'],'C2.A':['New']}
df1 = pd.DataFrame(data=df1)`
df2 = {'A': ['PC','PC'], 'B': [11001,11001],'C':['Core','SE'],'C.A':['Old','New']}
df2 = pd.DataFrame(data=df2)
