You could try this:
import pandas as pd
import numpy as np
a = pd.DataFrame({
'c1': ['a',np.NaN,np.NaN,np.NaN,'a'],
'c2': [np.NaN,'b',np.NaN,'b',np.NaN],
'c3': [np.NaN,np.NaN,'c',np.NaN,np.NaN]
})
newdf=pd.DataFrame({'c4':a.fillna('').values.sum(axis=1)})
Output:
newdf
c4
0 a
1 b
2 c
3 b
4 a
I just see this option retrieved from jpp's answer, where jpp take advantage of the fact that np.nan != np.nan
and uses a list comprehension, maybe it could be the fastest way:
newdf=pd.DataFrame({'c4':[i for row in a.values for i in row if i == i]})
print(newdf)