Plotly using DatetimeIndex - Time series data

Good day. New to Dash/Plotly. Currently practicing using Jupyter Notebook. I am using a simple df that I want to aggregate total volume per year (using time-series data). However I notice when I plot the bar chart - the year is shown as 2016,5 2017, 2017.5…seeing that in the dataframe I only have unique years.

Hi @barnez29, welcome to the Plotly community.
Since you extract the year from your datetime indices with df.index.year, now Year in your aggregated dataframe is of numerical type (int), so Plotly will handle it as a continuous variable by default, hence the floating points.

Not sure it’s the best solution but to force the categorical axis, you can pass Year as strings inside your bar chart.