I have a pandas data frame that is a vector with a value and an index, say:
row1 10 row1 11 row2 9 row2 8
However, I want to create a 2x2 matrix from this, in which the row index is actually a header (column index). Like this:
row1 row2 10 9 11 8
What is the most efficient way of doing this? This example is a simplification, but I could be dealing with thousands of data points. Does pandas have a specific function for joining items with same index into a table?
Observation: all indexes would have the same number of entries.