I am New in Python. Whenever I am trying to compile the following code to get a line graph shows some errors. But I don't know how to fix it. Here is my code :
import plotly.plotly as py import plotly.graph_objs as go # Create random data with numpy import numpy as np N = 500 random_x = np.linspace(0, 1, N) random_y = np.random.randn(N) # Create a trace trace = go.Scatter( x = random_x, y = random_y ) data = [trace] py.iplot(data, filename='basic-line')
Shows the following error :
mks@mks-H81M-S /media/mks/KUTUBUDDIN1/test $ python datdaPlot.py Traceback (most recent call last): File "datdaPlot.py", line 1, in <module> import plotly.plotly as py ImportError: No module named plotly.plotly mks@mks-H81M-S /media/mks/KUTUBUDDIN1/test $
Please help to fix this. Thanks in advance.
Added:
According to Spandan Brahmbhatt, I have installed pip by sudo pip install plotly
. But still shows the following error:
We can access this API in python using the plot.ly package. To install the package, open up terminal and type $ pip install plotly or $ sudo pip install plotly . Plotly's graphs are hosted using an online web service, so you'll first have to setup a free account online to store your plots.
Via pip. Just running pip install plotly_express==0.4. 0 in your terminal should do it!
You will need to install them first.
pip install plotly pip install cufflinks
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With