<human>:  Counting the number of non-NaN elements in a numpy ndarray matrix in Python
<bot>: Here is some code to count the number of non-nan elements in a numpy ndarray matrix `data`

np.count_nonzero(~np.isnan(data))

#Warning: this code generation is experimental. Please inspect the code for any bugs before executing.