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

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -