✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚡️ Concerned about the grid? Kyle Baranko teaches how to predicting peak loads using XGBoost. Register for the August webinar!

Plotly Express Bar Graph goes blank if I add an X axis columns

So, I have the info on the df I’m using:

<class ‘pandas.core.frame.DataFrame’>
RangeIndex: 10 entries, 0 to 9
Data columns (total 2 columns):

Column Non-Null Count Dtype


0 ncm 10 non-null object
1 PM 10 non-null float64
dtypes: float64(1), object(1)
memory usage: 288.0+ bytes

If I plot the graph with the following code, the graph comes out great, but with no x-axis labels:

px.bar(data_frame = teste, y=‘PM’)

If I specify the columns to be uses in the x-axis, like in the code bellow, the graph does completely blank:

px.bar(data_frame = teste, x=‘ncm’, y=‘PM’)

The ‘ncm’ columns, is mixed, some elements are int’s and some are str’s. One thing I’ve noticed is that if I remove all int’s and keep only the str’s, the graph plots great, but I need all of the data. Even after converting all the int’s to str, the problems persists.

I’m new to plotly, so any help is welcome. Does anyone know how to solve this?
Thank’s in advance.