Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

pandas set index

>>> df.index = [x for x in range(1, len(df.values)+1)]
>>> df
             name                  job  score
1  'Pete Houston'  'Software Engineer'     92
2     'John Wick'           'Assassin'     95
3   'Bruce Wayne'             'Batman'     99
4    'Clark Kent'           'Superman'     96
Source by medium.com #
 
PREVIOUS NEXT
Tagged: #pandas #set #index
ADD COMMENT
Topic
Name
9+2 =