How can I create a new dataframe if the input looks like this:
inputTable = pd.DataFrame({
'A' : [1, 2, 3, 4, 5],
'B' : [2, 3, 4, 5, 6],
'C' : [3, 4, 5, 6, 7]
})
and the resulting table should look like this:
resultingTable = pd.DataFrame({
'Category' : ['A', 'A', 'A', 'A', 'A', 'B', 'B', 'B', 'B', 'B', 'C', 'C', 'C', 'C', 'C'],
'Value' : [1, 2, 3, 4, 5, 2, 3, 4, 5, 6, 3, 4, 5, 6, 7]
})
I am aware of pd.wide_to_long()
but it seems to be an overkill for the simple case I am dealing with. Is there something more appropriate and, perhaps, more efficient?