Python 无法从数据帧将经度和纬度传递给plotly choropleth map属性

Python 无法从数据帧将经度和纬度传递给plotly choropleth map属性,python,plotly,jupyter,choropleth,Python,Plotly,Jupyter,Choropleth,我得到以下错误: ValueError:为plotly.graph\u objs.Choropleth类型的对象指定的属性无效:“lat”您的latitude列中可能有无效值,我建议您只提供str列而不是序列 fig = px.choropleth(df, lat = df['latitude'], locationmode = 'country names', locations = df['cou

我得到以下错误:
ValueError:为plotly.graph\u objs.Choropleth类型的对象指定的属性无效:“lat”

您的
latitude
列中可能有无效值,我建议您只提供str列而不是序列
fig = px.choropleth(df,
                lat = df['latitude'],
                locationmode = 'country names',
                locations = df['country'],
                scope = 'africa',
                color = df['country'])