Warning since use of new environment

Below is an easy example of the problem. This used to work perfectly in the past but since I started working in a new environment, I get the error message below

‘’’
import pandas as pd
import numpy as np
import plotly.express as px

Define the data for each column

dates = pd.date_range(‘2024-01-01’, periods=10)
col1 = np.random.randint(1, 100, size=10) # Random integers between 1 and 100 for col1
col2 = np.random.randint(1, 100, size=10) # Random integers between 1 and 100 for col2
col3 = np.random.randint(1, 100, size=10) # Random integers between 1 and 100 for col3
col4 = np.random.randint(1, 100, size=10) # Random integers between 1 and 100 for col4
col5 = np.random.randint(1, 100, size=10) # Random integers between 1 and 100 for col5

Create the DataFrame

data = {‘datum’: dates, ‘col1’: col1, ‘col2’: col2, ‘col3’: col3, ‘col4’: col4, ‘col5’: col5}
df = pd.DataFrame(data)

Display the DataFrame

print(df)
list = [‘col1’,‘col5’]
fig = px.bar(df, x=df.index, y=list,barmode=‘group’)
fig.show()
‘’’
#warning: When grouping with a length-1 list-like, you will need to pass a length-1 tuple to get_group in a future version of pandas. Pass (name,) instead of name to silence this warning.

This warning seems to have appeared in pandas 2.2. It doesn’t turn up with pandas 2.1.3. I don’t know if there’s any way to get rid of it by changing your call to px.bar().

Is it a pandas bug ?

I think it’s the issue discussed at the link below. Not a Pandas bug, but a change in Pandas that required a change to be made in Plotly. I think it is all sorted now - do you still see this warning with Plotly 5.20?

"I did a test on another desktop. I now have no error message but also no graph.

The code you posted in your OP seems to be working fine for me:

plotly 5.20.0
pandas 2.2.2
jupyterlab 4.0.9

I’m wondering if having both ‘print()’ and ‘fig.show()’ in the same cell could be an issue in some environments, but otherwise you may need to give more details if you’re still having problems