Answers for "reset_index() pandas certain columnname"

23

reset_index pandas

df.reset_index(drop=True, inplace=True)
Posted by: Guest on September-27-2020
0

The following code shows how to reset the index of the DataFrame and drop the old index completely:

#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
Posted by: Guest on January-29-2022

Python Answers by Framework

Browse Popular Code Answers by Language