Join common text to multiple dataframes in one syntax

Viewed 14

Is there a way to join text in one syntax. I have 10 different dataframes to which I need to join the same text. I have done it separately for now. e.g.

 import pandas as pd

 df1 = pd.DataFrame({'Col1': [40, 30, 20], 'COl2': [50, 10, 5]})

 name = ['Sam'] 
 lis = []
 for i in name:
    lis.append(i)

  df = pd.DataFrame({'i': lis})  #Creating a dataframe to append the name
  df1 = df1.join(df)
  df1.join(df)
  df2.join(df) ...... so on

I want to do it in one syntax. Making a list of dataframes and join text

 [df1,df2,df3,df4].join(df)
0 Answers
Related