pandas.Series.str.cat() Method
The cat is the short form for concatenation. The cat() method is used for concatenating two or more strings. It takes the value of a particular column as an input along with the value of another column which has to be combined.
Syntax:
df['new_col_name'] = df['col_1_name'].str.cat(df['col_2_name'])
Parameters: It takes a parameter sep, where sep means separator, it is the special character that comes between the combined strings.
To work with Python Pandas, we need to import the pandas library. Below is the syntax,
import pandas as pd
Example:
Output:
need an explanation for this answer? contact us directly to get an explanation for this answer