Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def counts_of_all_values_rowwise(arr2d):
- # Unique values and its counts row wise
- num_counts_array = [np.unique(row, return_counts=True) for row in arr2d]
- # Counts of all values row wise
- 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