I need to shuffle by rows knowing that the first value in each row is a day number. Rows of the same day number should be kept together. Groups may contain 1, 2, 3 or 4 rows. Each row has the same number of values. Hope the examples below will tell you more.
I have this:
a = np.array([
[0, 0.02, 0.03, 0.04],
[0, 0.02, 0.03, 0.04],
[0, 0.02, 0.03, 0.04],
[1, 0.12, 0.13, 0.14],
[2, 0.22, 0.23, 0.24],
[2, 0.22, 0.23, 0.24],
[3, 0.32, 0.33, 0.34],
[3, 0.32, 0.33, 0.34],
[3, 0.32, 0.33, 0.34],
[3, 0.32, 0.33, 0.34]
])
I need to have this:
a = np.array([
[3, 0.32, 0.33, 0.34],
[3, 0.32, 0.33, 0.34],
[3, 0.32, 0.33, 0.34],
[3, 0.32, 0.33, 0.34],
[0, 0.02, 0.03, 0.04],
[0, 0.02, 0.03, 0.04],
[0, 0.02, 0.03, 0.04],
[2, 0.22, 0.23, 0.24],
[2, 0.22, 0.23, 0.24],
[1, 0.12, 0.13, 0.14]
])