Моя идея состоит в том, чтобы подготовить карту США с информацией, в которой указано «рожденное» наибольшее количество игроков НБА.
, и я нашел этот урок https://plot.ly/python/choropleth-maps/
Я пытался изменить код следующим образом:
import plotly.plotly as py
import pandas as pd
df = pd.ExcelFile('playersnba.xlsx')
data = [ dict(
type = 'choropleth',
locations = df['State'],
z = df['Numbers'],
text = df['State'],
colorscale = [[0,"rgb(5, 10, 172)"],[0.35,"rgb(40, 60, 190)"],[0.5,"rgb(70, 100, 245)"],\
[0.6,"rgb(90, 120, 245)"],[0.7,"rgb(106, 137, 247)"],[1,"rgb(220, 220, 220)"]],
autocolorscale = False,
reversescale = True,
marker = dict(
line = dict (
color = 'rgb(180,180,180)',
width = 0.5
) ),
colorbar = dict(
autotick = False,
tickprefix = '#',
title = 'players'),
) ]
Моя проблема:
...line 8, in <module>
locations = df['State'],
TypeError: 'ExcelFile' object is not subscriptable