I want to add a new column in a dataframe with values from some other dataframe. My new column name is a variable and I cannot hardcode it.
new_column = "my_new_column_name"
df = df.assign(new_column=other_df['Column1'].values)
The problem is that, I am getting a new column named new_column
.
What I expect is a column named my_new_column_name
Can anyone please suggest a solution for this.