I have a 6-column multidimensional array like:
[59, '591', '592', '593', '594', 1582823720],
[9, '91', '92', '93', '94', 1582823745],
[7, '71', '72', '73', '74', 1582823745],
[61, '611', '612', '613', '614', 1582823752],
[54, '541', '542', '543', '544', 1582823717],
[24, '241', '242', '243', '244', 1582823706]
Is there an easy way to shuffle only specific columns "vertically" while retaining other columns content intact?
For example above, lets say I need only to "vertically" shuffle columns 2-5, while leaving column 1 and 6 as is, so the result will be:
[59, '541', '242', '243', '74', 1582823720],
[9, '591', '542', '593', '94', 1582823745],
[7, '241', '612', '543', '614', 1582823745],
[61, '611', '92', '73', '544', 1582823752],
[54, '71', '72', '613', '594', 1582823717],
[24, '91', '592', '93', '244', 1582823706]
I am new to Python and maybe there is a simple built-in solution or a certain module that would do it?
I've came across numpy
library that made shuffling entire array rows "vertically" a breeze with a random.shuffle()
function, maybe there is one to just shuffle specific columns?