Premium problem141. Coalesce Two Rating Columns

Easy Locked

ratings is a 2-D float array of shape (n, 2) whose first column may contain np.nan. Return the 1-D array of length n taking column 0's value where it is present and column 1's value otherwise.

Input

[[4.5 3. ]
 [nan 2. ]
 [1.  nan]]

Output

[4.5 2.  1. ]

Premium problem

This one's part of Premium. Unlock the full NumPy track plus every other premium problem on the site.

Implement solve(...)