I have the following Pandas Dataframe:
df=pd.DataFrame({0:["a","b","c","d"], 1:["e","f","g",None], 2:["h",None,None,None]})
0 1 2
0 a e h
1 b f None
2 c g None
3 d None None
I like to create a new DataFrame with one column where each row is a concatenated string, with a seperator ",":
0
0 a,e,h
1 b,f
2 c,g
3 d
For a single row I could use
df.iloc[0,:].str.cat(sep=",")
but how can I apply this to the whole DataFrame, without using a for-loop (if possible)