Analyzing California State Scratchers

Let's figure out the expected loss of playing scratchers.

California publishes all of the information we need to determine this at their website http://www.calottery.com/play/scratchers-games/top-prizes-remaining

From there, for each game, we can see:

  1. Price of a ticket
  2. Value of each prize
  3. Odds of winning each prize
  4. Number of tickets printed for each prize
  5. Number of tickets claimed for each prize

They update the data every day.

With requests, beautifulsoup, and pandas, it's really easy to scrape each page and start analyzing.

import requests
from bs4 import BeautifulSoup as bs
import pandas as pd

sample_game_url = "http://www.calottery.com/LotteryHome/play/scratchers-games/$20-scratchers/100X-the-money-1230"

soup = bs(requests.get(sample_game_url).content)
df = pd.read_html(str(soup.find(class_='draw_games')))[0]
print(df)

dataframe

Yeeehaaww!

With a little more scripting and munging you can answer some cool questions, like "Of all the games that have sold less than 50% of their tickets, how close are they to matching their expected payout of grand prizes?"

The majority are under!

Actual Winners vs Expected Winners
Game Name Expected Winners Actual Winners Under Expected By
I HEART CALIFORNIA 199008.92 198337 671.92
5X CROSSWORD BONUS MATCH 19.85 6 13.85
LUCKY STREAK 3.11 0 3.11
HIT $500! 8.76 6 2.76
10X THE MONEY 9.23 7 2.23
MILLION DOLLAR MULTIPLIER 1.92 0 1.92
MYSTERY CROSSWORD 3.52 2 1.52
LUCKY SPOT 0.81 0 0.81
EXTRA CROSSWORD 1.79 1 0.79
TRIPLING BONUS CROSSWORD 1.54 1 0.54
$5,000,000 PLATINUM PAYOUT 6.52 6 0.52
20X THE MONEY 2.47 2 0.47
POWER 5'S 18.35 18 0.35
CALIFORNIA GOLD 0.25 0 0.25
ELECTRIC 7'S 3.92 4 -0.08
50X THE MONEY 1.83 2 -0.17
HIGH CARD POKER 0.49 1 -0.51
100X THE MONEY 1.95 3 -1.05

As of 2017-09-02, here is what the games looked like:

California Scratchers Expected Values
Game Name Expected Value
100X THE MONEY 93.90
$5,000,000 PLATINUM PAYOUT 92.39
CALIFORNIA GOLD 85.07
SET FOR LIFE 84.73
WINNING MILLIONS 80.67
LUCKY STREAK 80.44
CROSSWORD DELUXE 80.15
$20 CA BLACK PREMIUM 79.27
MYSTERY CROSSWORD 73.99
$10 CA BLACK PREMIUM 73.94
MILLION DOLLAR MULTIPLIER 73.69
SUPER TICKET 71.80
MONEY IN THE BANK 71.15
$5 CA BLACK PREMIUM 70.40
THE MULTIPLIER GAME 70.06
BLACKOUT BINGO 69.48
POWER 5'S 68.66
MEGA CROSSWORD 67.84
LUCKY FORTUNE 66.99
DOUBLE MATCH 66.35
$2 CA BLACK PREMIUM 65.52
HIGH CARD POKER 64.86
TWISTED 64.30
RUBY RED 7'S 63.61
5X CROSSWORD BONUS MATCH 63.35
LOTERIA 63.01
WILD BINGO 61.78
9'S IN A LINE 59.84
HIT $500! 59.65
GREAT 8'S 58.84
50X THE MONEY 56.92
EXTRA CROSSWORD 53.19
STINKIN' RICH 53.15
I HEART CALIFORNIA 53.02
20X THE MONEY 51.98
LUCKY SPOT 50.83
10X THE MONEY 47.10
TRIPLING BONUS CROSSWORD 46.68
ELECTRIC 7'S 46.27
INSTANT FAST CASH 14.77

Talk about a huge range of expected values! Look at that Instant Fast Cash!!!

That table was generated with pytablewriter. Super helpful.

Maybe I'll set this up somewhere and have it auto-update each day.