Int64Index 对象没有属性 get_values
Int64Index object has no attribute get_values
我正在做以下手册:https://towardsdatascience.com/mapping-geograph-data-in-python-610a963d2d7f
我从这段代码中收到以下错误:
# Plot Comuna
comuna = 'SANTIAGO'
com_id = df[df.NOM_COMUNA == comuna].index.get_values()[0]
plot_shape(com_id, comuna)
错误
AttributeError: 'Int64Index' 对象没有属性 'get_values'
从 pandas 版本 0.25.0 开始使用 to_numpy() because get_values is deprecated。
尝试:
comuna = 'SANTIAGO'
com_id = df[df.NOM_COMUNA == comuna].index.to_numpy()[0]
plot_shape(com_id, comuna)
我正在做以下手册:https://towardsdatascience.com/mapping-geograph-data-in-python-610a963d2d7f
我从这段代码中收到以下错误:
# Plot Comuna
comuna = 'SANTIAGO'
com_id = df[df.NOM_COMUNA == comuna].index.get_values()[0]
plot_shape(com_id, comuna)
错误
AttributeError: 'Int64Index' 对象没有属性 'get_values'
从 pandas 版本 0.25.0 开始使用 to_numpy() because get_values is deprecated。
尝试:
comuna = 'SANTIAGO'
com_id = df[df.NOM_COMUNA == comuna].index.to_numpy()[0]
plot_shape(com_id, comuna)