xxxxxxxxxx
# Basic syntax:
# If both columns are already string typed:
your_df["combined_col"] = your_df["column_1"] + your_df["column_2"]
# If one (or both) of the columns are not string typed:
your_df["combined_col"] = your_df["column_1"].astype(str) + your_df["column_2"]
xxxxxxxxxx
#suppose you have two dataframes df1 and df2, and
#you need to merge them along the column id
df_merge_col = pd.merge(df1, df2, on='id')
xxxxxxxxxx
cols = ['foo', 'bar', 'new']
df['combined'] = df[cols].apply(lambda row: '_'.join(row.values.astype(str)), axis=1)
xxxxxxxxxx
df["station"] = df["End station"].combine_first(df["Start station"])
df.drop(["End station", "Start station"], 1, inplace=True)