python - How to reset index in a pandas data frame? -


i have data frame remove rows. result, data frame in index that: [1,5,6,10,11] , reset [0,1,2,3,4]. how can it?

added

the following seems work:

df = df.reset_index() del df['index'] 

the following not work:

df = df.reindex() 

reset_index() you're looking for. if don't want saved column, then

df = df.reset_index(drop=true) 

Comments

Popular posts from this blog

sql - Time in datatime field -

javascript - How to split the success output from an Ajax post? -

java - sharing object across different classes -