Resolved: How to rewrite or add a column start from 1 in python

In this post, we will see how to resolve How to rewrite or add a column start from 1 in python

Question:

I have a dataframe like this and I want to re-rank Startup Rank starting from 1,2,3,4… to end. Or can I add a column start from 1,2,3,4…. and remove the Startup Rank column?
enter image description here

Best Answer:

If you want to preserve the relative ranking, you can subtract the min value – 1:
Or for a new column:
If you want a brand new ranking top->down 1->n:

If you have better answer, please add a comment about this, thank you!

Source: Stackoverflow.com