Concat function of pandas not fixing index


#1

I have been learning about the concat() method in pandas that is used to concatenate 2 data frames. However, it doesn’t seem to make changes to the index. The second dataframe gets concatenated to the first data frame but the index starts at 0 again after the end of data frame 1 content. How do I fix this?


#2

Hi @vijayraj96,

Set ignore_index to True, as follows …

menu = pd.concat([bakery, ice_cream], ignore_index=True)