Both the codes are used to concatenate the dataframes.
This code will take dataframes in the frames list and concatenate them forming a new dataframe.
This code will also concatenate the dataframes but the difference is that this code will add certain keys to the newly formed database to identify those dataframes. This is how the data is stored:
Here, x is the key to dataframe df1, y is the key to dataframe df2, z is the key to dataframe df3.