reset_index pandas
df.reset_index(drop=True, inplace=True)
DS in Training
df.reset_index(drop=True, inplace=True)
>>> df.reset_index(drop=True)
class max_speed
0 bird 389.0
1 bird 24.0
2 mammal 80.5
3 mammal NaN
df.reset_index(drop=True)
#reset index
df.reset_index(drop=True, inplace=True)
#view updated DataFrame
print(df)
points assists rebounds
0 25 5 11
1 12 7 8
2 15 7 10
3 14 9 6
4 19 12 6
5 23 9 5
6 25 9 9
7 29 4 12
import pandas as pd
# Reset index
df = df.reset_index()
# Display DataFrame
print(df)
df.reset_index(drop = True, inplace = True)