KeyError: ‘plotly_domain’
Based on this answer, try using py.plot instead of py.iplot. KeyError: ‘plotly_domain’ when using plotly to do scatter plot in python The reason is that iplot is for ipython sessions.
Based on this answer, try using py.plot instead of py.iplot. KeyError: ‘plotly_domain’ when using plotly to do scatter plot in python The reason is that iplot is for ipython sessions.
In order to set a general default value for all keys, you can use defaultdict:
Your main problem is this line: You think you’re making a copy of the dictionary, but actually you still have just one dictionary, so operations on dicta also change aDict (and so, you remove values from adict, they also get removed from aDict, and so you get your KeyError). One solution would be (You should … Read more
The error you’re getting is that self.adj doesn’t already have a key 0. You’re trying to append to a list that doesn’t exist yet. Consider using a defaultdict instead, replacing this line (in __init__): with this: You’ll need to import at the top: Now rather than raise a KeyError, self.adj[0].append(edge) will create a list automatically to append to.