1-844-696-6465 (US)        +91 77600 44484        help@dezyre.com

Question on Pandas adding String


I have a database of 3000 rows and 100 columns which i have pulled in from the excel, I am trying to create a new column by adding string together which i want to create an index to merge databases.

ie DF["New column'}= DF["Column A"]+DF ["Column B"]. This is working for rows where we have string values present in both columns , when there is string value missing for only one row the new column is coming as blank for that row rather than taking the other cell. 


5= 2+3

___= 2+___

Trying to add strings , instead of numbers 


1 Answer(s)


I believe what you are looking for here is:

df['col3'] = df[['col1', 'col2']].apply(lambda x: ''.join(x))


df['col3'] = df[['col1', 'col2']].apply(lambda x: ''.join([str (I) for I in x]))


Your Answer

Click on this code-snippet-icon icon to add code snippet.

Upload Files (Maximum image file size - 1.5 MB, other file size - 10 MB, total size - not more than 50 MB)