0

I have a matrix having the form:

 a=[[1 0 0 0 0],
  [0 0 1 0 0],
  [0 1 0 0 0],
  [0 0 0 1 0],
  [0 0 0 0 1]]

and I would like to conver the vector a in a matrix having the form:

 b=[[0],[2],[1],[3],[4]]

So basically, I would like to convert the binary matrix into an integer matrix which entries correspond to the index/position of "1" in the a matrix.

Do you have any idea how it works in python?

user3043636
  • 559
  • 6
  • 23
  • So, `a.argmax(axis=1)`? – cs95 Feb 08 '19 at 23:12
  • This sound like a good exercise to practice some programming. Start by describing the steps to take to solve the problem. Do this using English (or your favorite written language) without worrying about Python syntax. Once you have a clear idea of the steps, you can then translate them into Python. – Code-Apprentice Feb 08 '19 at 23:14

0 Answers0