answered 8 years ago
Here is an option:
r=[Integer(len(A.nonzero_positions_in_column(j))) for j in range(A.dimensions()[1])] A.insert_row(0, r)