Skip to content

Commit

Permalink
format bar chart
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmajestic committed Feb 24, 2024
1 parent d787191 commit a8e7f12
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions odds.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,13 @@ async def get_calcs():
# Convert the data to a pandas DataFrame
df = pd.DataFrame(data)

# Group the data by the bookmaker and calculate the average price difference
grouped = df.groupby('bookmaker')['price_diff'].mean().reset_index()

# Generate a plot
plt.figure(figsize=(10, 6))
df.set_index('bookmaker')['price_diff'].plot(kind='bar')
plt.ylabel('Price Difference')
grouped.set_index('bookmaker')['price_diff'].plot(kind='bar')
plt.ylabel('Average Price Difference')

# Save the plot to a BytesIO object
img = io.BytesIO()
Expand Down

0 comments on commit a8e7f12

Please sign in to comment.