Black Lives Matter. Please consider donating to Black Girls Code today.

Strange error: PlotlyDictValueError: 'data' has invalid value inside 'figure'

Downloaded data from quandl and am continuously getting an error. They are floats. The json from the traces looks ok. But nothing seems to work. The index is a date time. Everything is fine. Is it quandl data?

`qd=pd.read_csv(’~/Documents/ugh.csv’)
#qd=other_importer().quandl_prep(“YAHOO/INDEX_GSPC”, “2011-04-21”)
qd[‘Open’]=qd[‘Open’].round(3)
qd[‘Open’]=qd[‘Open’].astype(float)
qd[‘Close’]=qd[‘Close’].astype(float)
traceqd = go.Scatter(
x=qd.index,
y=qd[‘Open’].values,
name=‘ugh’

    )

layout = go.Layout(
title=‘Stitched Returns’,
hovermode=‘closest’,
xaxis=dict(
title=‘Date’,
ticklen=5,
zeroline=False,
gridwidth=2,
),
yaxis=dict(
title=‘Returns’,
ticklen=5,
zeroline=False,
gridwidth=2,
),
)
fig = go.Figure(data=traceqd, layout=layout)`

That’s the code.

Here’s the error:


PlotlyDictValueError Traceback (most recent call last)
in ()
26 ),
27 )
—> 28 fig = go.Figure(data=traceqd, layout=layout)

/Users/stevenglinert/anaconda2/lib/python2.7/site-packages/plotly/graph_objs/graph_objs.pyc in init(self, *args, **kwargs)
831
832 def init(self, *args, **kwargs):
–> 833 super(figure_class, self).init(*args, **kwargs)
834 if ‘data’ not in self:
835 self.data = GraphObjectFactory.create(‘data’, _parent=self,

/Users/stevenglinert/anaconda2/lib/python2.7/site-packages/plotly/graph_objs/graph_objs.pyc in init(self, *args, **kwargs)
373 d = {key: val for key, val in dict(*args, **kwargs).items()}
374 for key, val in d.items():
–> 375 self.setitem(key, val, _raise=_raise)
376
377 def dir(self):

/Users/stevenglinert/anaconda2/lib/python2.7/site-packages/plotly/graph_objs/graph_objs.pyc in setitem(self, key, value, _raise)
428
429 if self._get_attribute_role(key) == ‘object’:
–> 430 value = self._value_to_graph_object(key, value, _raise=_raise)
431 if not isinstance(value, (PlotlyDict, PlotlyList)):
432 return

/Users/stevenglinert/anaconda2/lib/python2.7/site-packages/plotly/graph_objs/graph_objs.pyc in _value_to_graph_object(self, key, value, _raise)
533 if _raise:
534 path = self._get_path() + (key, )
–> 535 raise exceptions.PlotlyDictValueError(self, path)
536 else:
537 return

PlotlyDictValueError: ‘data’ has invalid value inside ‘figure’

Path To Error: [‘data’]

Current path: []
Current parent object_names: []

Additionally:

role: object