Has anyone encountered a ‘Syntax Error’ while working through the programmatic “Plotly Dashboard” tutorial.
The code I’m working with looks like:
import plotly.dashboard_objs as dashboard
import IPython.display
from IPython.display import Image
my_dboard = dashboard.Dashboard()
my_dboard.get_preview()
def fileId_from_url(url):
""“Return fileId from a url.”""
index = url.find(’~’)
fileId = url[index + 1:]
local_id_index = fileId.find(’/’)
share_key_index = fileId.find('?share_key')
if share_key_index == -1:
return fileId.replace('/', ':')
else:
return fileId[:share_key_index].replace('/', ':')
def sharekey_from_url(url):
""“Return the sharekey from a url.”""
index = url.find(‘share_key=’)
return url[index + len(‘share_key=’):]
fileId_1 = fileId_from_url(~dajreamdigital/10#plot)
fileId_2 = fileId_from_url(~dajreamdigital/17)
box_a = {
‘type’: ‘box’,
‘boxType’: ‘plot’,
‘fileId’: fileId_1,
‘title’: ‘scatter-for-dashboard’
}
text_for_box = “”"
Distributions:
Scatter Plot
- Ranging 0 - 500
- Even distribution
Box Plot
- Similar Range
- Outliers present in trace 1 and trace 3
You can view more markdown tips here.
"""
box_b = {
‘type’: ‘box’,
‘boxType’: ‘text’,
‘text’: text_for_box,
‘title’: ‘Markdown Options for Text Box’
}
box_c = {
‘type’: ‘box’,
‘boxType’: ‘plot’,
‘fileId’: fileId_2,
‘title’: ‘box-for-dashboard’,
}
my_dboard.insert(box_a)
and the Traceback is:
File “”, line 29
box_a = {
^
SyntaxError: invalid syntax
Any help would be appreciate.
Thanks, in advance.