I want to make a pandas dataframe with three columns, such that the rows contain all permutations of three columns, each with its own range of values are included. In addition, I want to sort them asc by c1, c2, c3.
For example, a = [0,1,2,3,4,5,6,7], b = [0,1,2], and c= [0,1]. The result I want looks like this:
c1 c2 c3
0 0 0
0 0 1
0 1 0
0 1 1
0 2 0
0 2 1
1 0 0
1 0 1
1 1 0
...
7 2 0
7 2 1
I keep trying to fill columns using numpy.arange, i.e., numpy.arange(0,7,1) for c1. But that doesn't easily create all the possible rows. In my example, I should end up with 8 * 3 * 2 = 48 unique rows of three values each.
I need this to act as a mask of all possible value combinations from which I can merge a sparse matrix of experimental data.
Does anyone know how to do this? Recursion?