In matplotlib I generated a graph using this code:
df_pre_2003.groupby(['StateName'])
['nAllNeonic'].sum().plot(kind='bar')
plt.title("Neonic usage by state prior to 2003")
plt.rcParams["figure.figsize"] = (10, 5)
plt.rcParams["xtick.labelsize"] = 10
plt.rcParams["ytick.labelsize"] = 10
Which gave me this:
Now in plotly I have this code:
data=[go.Bar(x=df_2003.StateName, y=df_2003.nAllNeonic)]
iplot(data, filename=โtestbarโ)
Which gives me something similar but not correct since the y is not summed. But, when I try to sum by adding y=df_2003.nAllNeonic).sum() it it says:
ValueError:
Invalid value of type โnumpy.float64โ received for the โyโ property of bar
Received value: 50.97505208286809The 'y' property is an array that may be specified as a tuple, list, numpy array, or pandas Series
Itโs probably a simple fix but, I seem to be having a hard time. Side note this is the first time I have used plotly.