Pandas long to wide reshape, by two variables
I have data in long format and am trying to reshape to wide, but there doesn’t seem to be a straightforward way to do this using melt/stack/unstack:
I have data in long format and am trying to reshape to wide, but there doesn’t seem to be a straightforward way to do this using melt/stack/unstack:
While implementing a Kronecker-product for pedagogical reasons (without using the obvious and readily available np.kron()), I obtained a 4 dimensional array as an intermediate result, which I’ve to reshape to get the final result.
Let’s assume that I have the following dataframe in pandas:
Consider an array of the following form (just an example):
I cannot figure out how to do “reverse melt” using Pandas in python.
This is my starting data
Given this CSV file: