Advertisement
elena1234

concatenate two columns into one new column

May 21st, 2022
964
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.20 KB | None | 0 0
  1. # concatenates the string values from category_0 with category_1 into new column named 'categories',
  2. # separated by a ','
  3. df['categories'] = df['category_0'].str.cat(df['category_1'], sep = ', ')
  4. df.head()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement