def concat_with_pipe(x, cols=None):
    """Concatenate a `pd.Series` separated by `|`, drop `None` or `np.nan`"""
    cols = cols or x.index
    return '|'.join([x[i] for i in cols if x[i] not in [None, np.nan]])
def concat_with_pipe ( x , cols = None ) : cols = cols or x . index return '|' . join ( [ x [ i ] for i in cols if x [ i ] not in [ None , np . nan ] ] )
Concatenate a `pd.Series` separated by `|`, drop `None` or `np.nan`