Premium problem144. First Available Phone Number

Easy Locked

contacts has columns contact_id, primary_phone, secondary_phone and emergency_phone, any of which can be missing.

Add a best_phone column holding the first non-missing value in that order, or NaN when all three are missing. Return the original columns plus best_phone, index unchanged.

Input

   contact_id primary_phone secondary_phone emergency_phone
0           1           111             222             444
1           2          None             333             555
2           3          None            None             666
3           4          None            None            None

Output

   contact_id primary_phone secondary_phone emergency_phone best_phone
0           1           111             222             444        111
1           2          None             333             555        333
2           3          None            None             666        666
3           4          None            None            None       None

Premium problem

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

Implement solve(...)