The code you've posted already does what you want, but does not do it "in place." Try adding inplace=True
to reset_index()
or else reassigning the result to df_all
. Note that you can also use inplace=True
with dropna()
, so:
df_all.dropna(inplace=True)
df_all.reset_index(drop=True, inplace=True)
Does it all in place. Or,
df_all = df_all.dropna()
df_all = df_all.reset_index(drop=True)
to reassign df_all
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…