Hello community. Have followed the docs and tutorials but somehow when I plot - the graph is empty. I want to do a quarterly view for one year. My filtered data does return the correct view. However plot is empty. code below:
avos['year'] = avos['date'].dt.year
avos['quarter'] = avos['date'].dt.quarter
avos['quarter'] = avos['date'].dt.to_period('Q')
quarterly_data = df.groupby(['year', 'quarter'])['total_volume'].sum().reset_index()
quarterly_data
selected_year = 2015 # Replace with your selected year
filtered_data = quarterly_data[quarterly_data['year'] == selected_year]
filtered_data
year quarter total_volume
0 2015 2015Q1 3.679696e+08
1 2015 2015Q2 4.010053e+08
2 2015 2015Q3 3.653920e+08
3 2015 2015Q4 3.244999e+08
fig = go.Figure()
fig.add_trace(go.Bar(
x=filtered_data["quarter"].dt.end_time, # Align to the start of each quarter
y=filtered_data["total_volume"],
xperiod="Q1",
xperiodalignment="start", # Align periods to the start
))
# Customize the layout
fig.update_layout(
title=f"Total Value per Quarter for {selected_year}",
xaxis_title="Quarter",
yaxis_title="Total Value",
)
fig.update_xaxes(dtick="M3", tickformat="Q%q'%y")
# Show the plot
fig.show()