1
gd = df.groupby(['subID'])['Accuracy'].std()

print(gd)

subID
4       0.810423
5       0.841364
6       0.881007
8       0.763175
9       0.760102
10      0.905283
12      0.928358
14      0.779291
15      0.912377
1018    0.926683

It displays like this and I assume it is a Series, not a DataFrame. I want to change the last index from 1018 to 13.

  • 2
    when you want the index to start from 0 to the maximum number you can also consider `gd = gd.reset_index()` – Björn Apr 09 '20 at 10:47

1 Answers1

4

Use rename with dictionary, because first column here is index of Series:

gd = gd.rename({1018:13})

Working like:

gd = gd.rename(index={1018:13})
jezrael
  • 822,522
  • 95
  • 1,334
  • 1,252