🏥 🏭 Working on the COVID-19 response in Canada? Plotly & the Canadian government can help you and your organization. Learn more and get in touch.

Cannot plot via python

Here is a simpler example that does not work for me. what error am i doing?

import chart_studio.plotly as py

import plotly.express as px

import pandas_datareader as pdr
import datetime

vale3 = pdr.get_data_yahoo(‘GOOG’,
start=datetime.datetime(2016, 10, 1),
end=datetime.datetime(2019, 1, 1))

Daily log returns

daily_log_returns = np.log(vale3.Close.pct_change()+1)
display(vale3.Close ).head(10)
fig = px.line(vale3.Close, x=‘Date’, y=‘vale3.Close’)
fig.show()

This is what i am gettng

Date
2016-10-03 772.559998
2016-10-04 776.429993
2016-10-05 776.469971
2016-10-06 776.859985
2016-10-07 775.080017

2018-12-24 976.219971
2018-12-26 1039.459961
2018-12-27 1043.880005
2018-12-28 1037.079956
2018-12-31 1035.609985
Name: Close, Length: 565, dtype: float64

AttributeError Traceback (most recent call last)
in
13 # Daily log returns
14 daily_log_returns = np.log(vale3.Close.pct_change()+1)
—> 15 display(vale3.Close ).head(10)
16 fig = px.line(vale3.Close, x=‘Date’, y=‘vale3.Close’)
17 fig.show()

AttributeError: ‘NoneType’ object has no attribute ‘head’