<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def coalesce(*series):
 """ Takes the first non-NaN value in order across the specified series, returning a new series. Mimics the coalesce function in dplyr and SQL. Args: *series: Series objects, typically represented in their symbolic form (like X.series). Example: df = pd.DataFrame({ 'a':[1,np.nan,np.nan,np.nan,np.nan], 'b':[2,3,np.nan,np.nan,np.nan], 'c':[np.nan,np.nan,4,5,np.nan], 'd':[6,7,8,9,np.nan] }) df >> transmute(coal=coalesce(X.a, X.b, X.c, X.d)) coal 0 1 1 3 2 4 3 5 4 np.nan """


    series = [pd.Series(s) for s in series]
    coalescer = pd.concat(series, axis=1)
    min_nonna = np.argmin(pd.isnull(coalescer).values, axis=1)
    min_nonna = [coalescer.columns[i] for i in min_nonna]
    return coalescer.lookup(np.arange(coalescer.shape[0]), min_nonna)