I would like to reset the name of the indices in a DataFrame in python to the same name with the first number dropped.
For example if my DataFrame is:
Sample 1 Sample 2
2706 retinopathy positive retinopathy negative
2707 retinopathy negative retinopathy negative
2708 retinopathy positive retinopathy positive
I want it to become:
Sample 1 Sample 2
706 retinopathy positive retinopathy negative
707 retinopathy negative retinopathy negative
708 retinopathy positive retinopathy positive
I have tried:
ret_metadata.rename(index={2706: '706'})
However I would like to change the index name for many different rows, maybe in a loop. Does anyone know how I could do this?
Thank you so much!