Home > OS >  Int64Index object has no attribute get_values
Int64Index object has no attribute get_values

Time:12-26

I am doing the following manual: https://towardsdatascience.com/mapping-geograph-data-in-python-610a963d2d7f

I'm getting the following error from this code:

# Plot Comuna
comuna = 'SANTIAGO'
com_id = df[df.NOM_COMUNA == comuna].index.get_values()[0]
plot_shape(com_id, comuna)

Error

AttributeError: 'Int64Index' object has no attribute 'get_values'

CodePudding user response:

Use to_numpy() because get_values is deprecated as of pandas version 0.25.0.

Try:

comuna = 'SANTIAGO'
com_id = df[df.NOM_COMUNA == comuna].index.to_numpy()[0]
plot_shape(com_id, comuna)
  • Related