I currently have n number of dataframes (dfs[n]) with IDs and X values and one dataframe (df) with IDs.
I would like to add X values to a new column in df if IDs of the X value match the ID of df and add 'X values n' as the column name.
for n in range(len(files)):
if dfs[n]['ID'] == df['ID']:
df = df.join(dfs[n]['X values'], on='ID', rsuffix = int(r))
print(df)
I tried this code but doesn't work.
Thank you for your help!
for frame in dfs; df=df.join(frame...)