I have a numpy array for ratings given by users on movies. The rating is between 1 and 5, while 0 means that a user does not rate on a movie. I want to calculate the average rating of each movie, and the average rating of each user. In other words, I will calculate the mean of each column or row of non-zero elements.
Is there an efficient numpy array function to handle this case? I know manually iterating ratings by columns or rows can solve the problem.
Thanks in advance!