Here is my dataframe:
A B
0 asdf|afsdf|fasd sdsd|wer|wer
1 sdfsdf sdfsdff
2 sdf|s sdfsde|sdf
I would like to form a column Cthat will contain the combined values ββfrom the column Aand the column Bto the first |, and if |not, then it simply joins the two columns. Also, when concatenating, I would like to insert --
here is what the column looks like C:
C
0 asdf--sdsd
1 sdfsdf--sdfsdff
2 sdf--sdfsde
I can go through each line with df.locand get what I need, but it's slow, and I wonder if there is a faster way to do this.
source
share