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?

2
  • So, a.argmax(axis=1)? Commented Feb 8, 2019 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. Commented Feb 8, 2019 at 23:14

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.