I want to scatter plot campcnt vs cnt by year, but I get error msg. How to fix this problem?
Thanks,
Jeff
Thanks,
Jeff
print(df.head()) app = dash.Dash() app.layout = html.Div([ dcc.Graph( id='life-exp-vs-gdp', figure={ 'data': [ go.Scatter( x=df[df['year'] == i]['cntcamp'], y=df[df['year'] == i]['cnt'], mode='markers', opacity=0.7, marker={ 'size': 15, 'line': {'width': 0.5, 'color': 'white'} }, name=i ) for i in df.year.unique() ], 'layout': go.Layout( xaxis={'type': 'log', 'title': 'Camp Count'}, yaxis={'title': 'Total count'}, margin={'l': 40, 'b': 40, 't': 10, 'r': 10}, legend={'x': 0, 'y': 1}, hovermode='closest' ) } ) ])
Output: year cntcamp cnt
0 2015 36 347318781
1 2017 100 115586825
2 2016 48 59420381
3 2018 49 12924098
4 2014 6 2052933
Error:Traceback (most recent call last):
File "<ipython-input-8-ddb45a8148ad>", line 20, in <module>
) for i in df.year.unique()
AttributeError: 'SASdata' object has no attribute 'year'