pandas index of code example
Example: pandas index
How to add index to the DataFrame at runtime
df["patient"] = ["patient-" + str( i ) for i in range( max( df.index ) + 1 )]
df.set_index( "patient", inplace=True )
---------------------------------------------------------------------
patient = pandas.Series( ["patient-" + str( i ) for i in range( max( df.index ) + 1 )] )
df.index = patient
---------------------------------------------------------------------
df.index = ["patient-" + str( i ) for i in range( max( df.index ) + 1 )]