Given a matrix
matrix = np.array([[1,2,3],[1,np.nan,3],[np.nan,np.nan,np.nan]])
Get a vector containing the minimum value for each row
vector_of_min_row_values = np.nanmin(matrix, axis=1)
How do you replace the NaN values in each row with the min values of the row. This should create a matrix like this:
output_matrix = np.array([[1,2,3],[1,1,3],[np.nan,np.nan,np.nan]])