Reset an index

import pandas as pd

Use reset_index to create a new sequential index.

df = pd.DataFrame([('S7003', 24.1),
                   ('S2344', 14.2),
                   ('B3404', 17.7),
                   ('E6911', 11.1)],
                   index=['1', '3', '5', '6'],
                   columns=('id', 'age'))
df
id age
1 S7003 24.1
3 S2344 14.2
5 B3404 17.7
6 E6911 11.1

The default behavior to move the existing index to a column.

df.reset_index()
index id age
0 1 S7003 24.1
1 3 S2344 14.2
2 5 B3404 17.7
3 6 E6911 11.1

But the original index can also be dropped.

df.reset_index(drop=True)
id age
0 S7003 24.1
1 S2344 14.2
2 B3404 17.7
3 E6911 11.1

If you spot any errors please let me know on twitter.