Liz Sander - 6 months ago 13

Python Question

I have a binary array, and I would like to convert it into a list of integers, where each int is a row of the array.

For example:

`from numpy import *`

a = array([[1, 1, 0, 0], [0, 1, 0, 0], [0, 1, 1, 1], [1, 1, 1, 1]])

I would like to convert

`a`

`[12, 4, 7, 15]`

Answer

Source (Stackoverflow)

Comments