Bar chart with dates mismatch

Hopefully this is the right spot, I have a df here

df

I am putting this into a bar chart with dates on the X and the profits on the Y. You can see on the next screenshot that the chart shows the 3/4 profit for 3/3 on the chart. The chart actually skips 3/3 altogether as everything is a day off. And if you zoom in it shows times like 5am, etc. I’m not sure what I am doing wrong here.

def dailyProfit(start_date, end_date):
    d1 = df.loc[(df.BET_DATE.dt.date >= start_date) & (df.BET_DATE.dt.date <= end_date)]

    test = pd.DataFrame(d1[['BET_ID', 'BET_NET_PROFIT', 'BET_DATE']], index=d1['BET_ID'])
    d4 = test.set_index(test['BET_ID'])['BET_NET_PROFIT'].groupby(test['BET_DATE'].dt.date).sum()
    #d4 = test.set_index('BET_ID')
    st.write(d4)
    return(d4)
    values = dailyProfit(mar_start_date, mar_end_date)

    st.bar_chart(values)

I’m sure I am screwing something up but just cant figure it out.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.