Home > other >  Convert a pandas.core.indexes.numeric.Int64Index to an integer
Convert a pandas.core.indexes.numeric.Int64Index to an integer

Time:10-27

I used the below code to return the index of a unique ID value

n = df.index[df['ID'] == 55555]

but n is a value of type pandas.core.indexes.numeric.Int64Index but I need it as an integer to complete the code below.

df.at[n, 'Name'] = 'John'

how can i extract the integer value of n ?

CodePudding user response:

You can just call [0]

df.at[n[0], 'Name'] = 'John'
  • Related