0

I come across a problem. And I am not familier with the python command. Assume there is a list containing 60 elements shown below, its size is [1,60].

A=[1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0]

Is it possible that can I convert the A list with size [1,60] into the list with size[20,3], like:

[[1,1,0],[0,1,1],[0,0,1],[0,0,0],[0,0,1].......[0,1,1],[0,1,0]]

Currently, I have no ideas how to achieve that. Could you please give me some advices? Thank you very much.

czy
  • 427
  • 2
  • 3
  • 11
  • the result of ```numpy.array([1,2,3,4,5,6]).reshape((2, -1))``` is ```[[1 2 3] [4 5 6]]```, hope it helps~ – cg-zhou Dec 16 '21 at 05:26

0 Answers0