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

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -