Hello,
Below is the sample code.
df = pd.read_excel(r'output.xlsx')
df_ref = pd.read_excel(r'3G_Ref.xlsx')
df_final = df.merge(df_ref,how='inner', left_on=['HOUR_ID', 'Day_NAME','WEEKDAY_ID'], right_on=['HOUR_ID', 'Day_NAME','WEEKDAY_ID'])
df_final['Day_ID'] = df_final['WEEKDAY_ID'].astype(str)+'-'+df_final['Day_NAME'].astype(str)
df_final["Hour"] = df_final.HOUR_ID.map("{:02}".format)
df_final['x-axis'] = tuple(zip(df_final['Day_ID'],df_final['Hour'].astype(str)))
df_final.sort_values('x-axis',inplace=True)
curdoc().theme = 'dark_minimal'
plot_dod=figure(plot_width=1000,plot_height=500,toolbar_location="right",
x_range=FactorRange(*pd[x]))
plot_dod.xaxis.axis_label="Day - Hour"
plot_dod.xaxis.major_label_orientation = 1.5
plot_dod.xaxis.major_label_text_font = "arial"
plot_dod.xaxis.major_tick_line_color = None
plot_dod.xaxis.major_label_text_font_size = "7pt"
plot_dod.xaxis.group_text_font_size = "10pt"
plot_dod.xaxis.separator_line_dash_offset = 0
plot_dod.xaxis.major_label_standoff = 3
cds = ColumnDataSource(df_final)
plot_dod.line(x = 'x-axis',y = 'data',color='orange',line_width=2, alpha=1, legend_label = "Live",source = cds)
plot_dod.line(x = 'x-axis',y = 'data_ref',color='cadetblue',line_width=2,line_dash='dashed', alpha=1, legend_label = "Ref",source = cds)
It looks like when plotting, the hour is still considered as string and showing all the values. I have also attached the snapshot how it looks like… (data is week over week hourly comparison per day)