The code you posted already does what you want, but doesnβt do it "in place." Try adding inplace=True to reset_index() or reassign the result to df_all . Note that you can also use inplace=True with dropna() , therefore:
df_all.dropna(inplace=True) df_all.reset_index(drop=True, inplace=True)
Is everything in place. Or,
df_all = df_all.dropna() df_all = df_all.reset_index(drop=True)
reassign df_all .
John zwinck
source share