Advertisement
Guest User

Untitled

a guest
Nov 20th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. def counts_of_all_values_rowwise(arr2d):
  2. # Unique values and its counts row wise
  3. num_counts_array = [np.unique(row, return_counts=True) for row in arr2d]
  4.  
  5. # Counts of all values row wise
  6. return([[int(b[a==i]) if i in a else 0 for i in np.unique(arr2d)] for a, b in num_counts_array])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement