cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Plotting in pyspark.pandas Uncaught ReferenceError Plotly is not defined

Data_Cowboy
New Contributor III

Hi,

I am trying to plot using pyspark.pandas running this sample code:

speed = [0.1, 17.5, 40, 48, 52, 69, 88]
lifespan = [2, 8, 70, 1.5, 25, 12, 28]
index = ['snail', 'pig', 'elephant',
         'rabbit', 'giraffe', 'coyote', 'horse']
psdf = ps.DataFrame({'speed': speed,
                     'lifespan': lifespan}, index=index)
psdf.plot.bar()

When I run the code, it returns the following error:

Error Message 

This code can be found in this notebook from Microsoft (https://docs.microsoft.com/en-us/azure/databricks/_static/notebooks/pandas-to-pandas-api-on-spark-in-10-minutes.html).

Is there something that I need to define Plotly?

Please let me know if I may provide any additional information. Thank you for your assistance.

1 ACCEPTED SOLUTION

Accepted Solutions

Data_Cowboy
New Contributor III

Thank you @Werner Stinckensโ€‹ . I was able to find the plotly documentation listed below and setting the output_type and calling displayHTML() helped remedy the error.

View solution in original post

3 REPLIES 3

Data_Cowboy
New Contributor III

Just wanted to follow up on this, using matplotlib as the backend circumvents this error.

ps.set_option("plotting.backend", "matplotlib")

-werners-
Esteemed Contributor III

can you check the visualisation docs?

There is a page for plotly.

Data_Cowboy
New Contributor III

Thank you @Werner Stinckensโ€‹ . I was able to find the plotly documentation listed below and setting the output_type and calling displayHTML() helped remedy the error.

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group