Wanting to do something similar to this, but complete row aggregation even when nulls are present without including them.
import pandas as pd
import numpy as np
df = pd.DataFrame(data= {'Subject': ['X', 'G', 'H', 'M'],
'Col1': ['cat', 'dog', np.nan, 'horse'],
'Col2': [np.nan, 'black', 'brown', 'grey'],
'Col3': ['small', 'medium', 'large', 'large']})
df['Col4'] = df['Col1'] + ', ' + df['Col2'] + ', ' + df['Col3']
For clarification, this is the resulting dataframe I am looking for
Subject Col1 Col2 Col3 Col4
0 X cat NaN small cat, small
1 G dog black medium dog, black, medium
2 H NaN brown large brown, large
3 M horse grey large horse, grey, large
