I'm fairly sure this is a duplicate, but suppose I have a pandas DataFrame and I've sorted the rows based on the values of some column. Originally the indices were the integers 0, 1, …, n-1
but now they're out of order. How do I reassign these indices to be in the proper order for the new sorted DataFrame?
df.reset_index(drop=True, inplace=True)
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments