Given the following:
df = pd.DataFrame({'col1' : ["a","b"],
'col2' : ["ab",np.nan], 'col3' : ["w","e"]})
I would like to be able to create a column that joins the content of all three columns into one string, separated by the character "*" while ignoring NaN
.
so that I would get something like that for example:
a*ab*w
b*e
Any ideas?
Just realised there were a few additional requirements, I needed the method to work with ints and floats and also to be able to deal with special characters (e.g., letters of Spanish alphabet).