Black Lives Matter. Please consider donating to Black Girls Code today.

How to convert pandas IntervalIndex for histgram plotting?

I’m using pandas IntervalIndex to define bins for dataframes. Now I’d like to plot a histogram using with the bin intervals for the x axis values. How can I convert easiest?

@fkromer Unfortunately you cannot use the intervals in a pd.IntervalIndex as prescribed bins, to define a plotly Histogram, because for a Histogram (with vertical bars) you can set either the number of bins, as
nbinsx or the start, and end values, as well as the size of bins.

For more Histrogram attributes run:

@empet Thx for the hint. The most easy way to get something toi work is by converting the pd.IntervalIndices to strings with .astype(str).