Skip to content
Advertisement

TypeError: plot() missing 1 required positional argument: ‘kind’

I am working through a Kaggle tutorial on a network graphic with plotly. After some updating to get the code compatible with chart_studio, I am now getting the error:

JavaScript

The code I have entered to try and get the graph is:

JavaScript

Any help would be appreciated.

I have looked around trying to figure out what kind means and how to adapt it for this graph.

Full traceback:

JavaScript

Advertisement

Answer

The problem comes from the ambiguous import statements that both your code and the tutorial use.

You have

JavaScript

which means that you define plotly twice, and only the second definition remains. The tutorial has the same problem, with from plotly import plotly followed by import plotly.

So when you call plotly.plot(), you’re not calling chart_studio.plotly.plot(), which I believe is your intention, but instead you’re calling the plot() function defined in plotly/__init__.py, whose in-code documentation says it’s not intended to be called directly.

Unless you know you need it, remove the line import plotly, or change one of those two import lines to say as <some other name>, which will let you refer to chart_studio.plotly and the base plotly by different, unambiguous names.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement