'''
dfs = reduce(lambda x,y: pd.merge(x,y, on='just_date', how='outer'), [date_game0, date_game1, date_game2, date_game3,date_game4, date_game5, date_game6, date_game7, date_game8, date_game9, date_game10])
'''
I am merging pandas dataframe by using the above code, but the columns names are repeating as shown in picture, how can change the column name for each data frame?
CodePudding user response:
# define a list with column names that you like
cols=['id1','date1','id2','date2', 'diff'] #just an example
# assign list to the df
df.columns=cols
df