cancel
Showing results for 
Search instead for 
Did you mean: 
Community Discussions
Connect with fellow community members to discuss general topics related to the Databricks platform, industry trends, and best practices. Share experiences, ask questions, and foster collaboration within the community.
cancel
Showing results for 
Search instead for 
Did you mean: 

Displaying Dataframes with ipywidgets.Output is Adding Unexpected Commas

yhyhy3
New Contributor III

I am currently working in a databricks notebook and using an ipywidgets.Output to display a pandas Dataframe. Because spark.DataFrame cannot be displayed in an ipywidgets.Output widget, I have been using:

import pandas as pd
import numpy as np
import ipywidgets
from IPython.display import display
df = pd.DataFrame(
  np.random.randint(0, 5, size=(4, 4))
)
output = ipywidgets.Output()
with output:
  display(df)

output

This has been working until recently on the 13.2 ML runtime. However, recently, I moved to a different cluster still using the same 13.2 ML runtime and am now getting a bunch of commas prepended to my html output (see screenshot). The larger the dataframe, the longer the number of commas. How can I fix this issue?

2 REPLIES 2

Kaniz_Fatma
Community Manager
Community Manager

Hi @yhyhy3Based on the information, the issue you are facing seems related to the ipywidgets library. The ipywidgets package is used to create interactive elements in Databricks notebooks.

However, there might be a compatibility issue with your version of ipywidgets.

To fix this issue, you can try the following steps:

1. Update the ipywidgets library: Make sure you are using the latest version of the ipywidgets library. You can update the library by running the following command in a Databricks notebook cell: 

   !pip install --upgrade ipywidgets
 

2. Restart the kernel: After updating the ipywidgets library, you might need to restart the seed of your Databricks notebook. You can do this by clicking on the "Kernel" menu and selecting "Restart".

3. Check the compatibility: Verify that the version of ipywidgets you are using is compatible with the Databricks runtime version you are using.

You can check the release notes for your Databricks runtime version to ensure compatibility. 

If the issue persists after trying these steps, filing a Databricks support ticket for further assistance is recommended.

cm04
New Contributor

I have this issue also, and the listed steps do not resolve it.

Join 100K+ Data Experts: Register Now & Grow with Us!

Excited to expand your horizons with us? Click here to Register and begin your journey to success!

Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!