Skip to main content Switch to mobile version strokes-gained 0.2.0 Calculate strokes gained in golf: expected strokes to hole out from any lie and distance, strokes gained per shot, hole and round, and strokes lost to scratch by handicap. From Mark Broadie's PGA Tour tables. Library, CLI and pandas helper, no dependencies. From Shotto, an AI agent for golf on iPhone and Apple Watch.
pip install strokes-gained Copy PIP instructions
Calculate strokes gained in golf with Python. Expected strokes to hole out from any lie and distance, strokes gained for every shot, hole and round, and how many strokes golfers at each handicap lose to a scratch golfer. A library and command line tool with no dependencies, plus an optional pandas helper, built on Mark Broadie's published PGA Tour tables. Python 3.9 and later. Also on npm: npx strokes-gained.
Made by Shotto, an AI agent for golf on iPhone and Apple Watch that tracks every shot from what you say and works out your strokes gained.
pip install strokes-gained strokes-gained hole "tee 410, fairway 150, green 20ft, green 3ft" 1. 410 y tee Off the tee +0.16 2. 150 y fairway Approach +0.17 3. 20 ft green Putting −0.15 4. 3 ft green Putting +0.06 4 on a par 4: +0.24 against a scratch golfer (+0.00 against the PGA Tour) Off the tee +0.16 · Approach +0.17 · Putting −0.09 Use it in Claude or ChatGPT
Add https://shottogolf.com/mcp to Claude or ChatGPT as a custom connector. It's free and needs no account. Then ask in plain words: "I drove it to 150 yards in the fairway, hit it to 20 feet and two-putted. What did each shot gain?" The assistant reads your description, and the connector does the maths with these same tables, against a scratch golfer unless you ask for the Tour or a handicap. Its tools are expected_strokes, strokes_gained (one hole or a whole round) and compare_to_handicap.
What is strokes gained?
Strokes gained measures each golf shot against a benchmark: the average number of strokes it takes to hole out from where the ball was. A shot that leaves you somewhere better than the benchmark expects gains strokes, and one that leaves you somewhere worse loses them. Added up over a round, it shows where your strokes are won and lost: off the tee, on approach shots, around the green and on the putting green.
strokes gained = expected strokes before the shot − expected strokes after it − 1 From 150 yards in the fairway a PGA Tour player averages 2.95 strokes to hole out, and from 20 feet on the green 1.87. So hitting it from 150 yards to 20 feet gains 2.95 − 1.87 − 1 = +0.08 strokes: slightly better than the average Tour player. Holing a 3-footer gains 1.04 − 0 − 1 = +0.04, and missing it loses about 0.96.
Mark Broadie developed the method at Columbia Business School and explains it in Every Shot Counts (2014). The PGA Tour has published strokes-gained statistics since 2011, starting with putting. There's a short guide at shottogolf.com/strokes-gained.
Against the Tour, scratch or any handicap
Broadie's tables are the average PGA Tour player, so every number starts there. Against the Tour nearly every amateur is negative, which says little about how a shot compares with golfers like you. So a hole can also be measured against a scratch golfer or any handicap index: that level's strokes per round, in each part of the game, are spread over a round's shots and added to each shot's Tour number. A tee shot or approach is worth about 0.1 more against scratch, and about 0.3 more against a typical 15 handicap.
The spread uses a typical round's shots per category (14 drives, 24 approaches, 8 shots around the green, 18 putted holes); pass a golfer's own counts for a closer reading. Putting's adjustment is per putted hole, split across the hole's putts. Shotto's app reads strokes gained the same way, with each golfer's own counts.
Strokes gained tables
Expected strokes to hole out for the average PGA Tour player, from Broadie's tables, and the strokes golfers at each handicap lose to a scratch golfer. Look up the spots before and after any shot and the formula above does the rest. Values between rows are interpolated.
From the fairway, rough, sand and recovery
Strokes lost to a scratch golfer, by handicap
Per 18 holes, for a typical golfer at each handicap.
The long game (tee shots and approaches) is where most of the strokes go at every level: about 8 of a 15-handicap's 14 strokes a round to scratch. The handicap rows come from Broadie's amateur data. We place his scoring groups at handicaps of about 5, 17 and 30, and interpolate between them.
Tracking your own strokes gained
Strokes gained only needs to know where each shot started and where it finished. There are three ways to get that for your own rounds:
Write it down yourself. Note each shot's lie and distance on the card or in a spreadsheet, then let this package do the maths (see pandas below).
Put sensors on your clubs, which tag each shot as you play.
Talk to Shotto. Say what happened after a shot, a few words to your Apple Watch or iPhone, or talk through the whole round on the drive home. Shotto places each shot on the hole and works out your strokes gained off the tee, on approach, around the green and putting, with nothing to tap on the course and nothing on your clubs. Its strokes gained comes from these same tables. It also keeps what sensors can't see, like the target you had in mind and how the swing felt. Shotto Golf is on the App Store, with a two-week free trial.
import strokes_gained as sg sg.expected_strokes({"lie": "fairway", "yards": 150}) # 2.945 sg.strokes_gained({"lie": "fairway", "yards": 150}, {"lie": "green", "feet": 20}) # 0.075 h = sg.hole([ {"lie": "tee", "yards": 410}, {"lie": "fairway", "yards": 150}, {"lie": "green", "feet": 20}, {"lie": "green", "feet": 3}, # the last one is holed ], par=4) h["byCategory"] # {'offTee': 0.06, 'approach': 0.075, 'aroundGreen': 0.0, 'putting': -0.13} # The same hole against a scratch golfer, or any handicap index positions = sg.parse_hole("tee 410, fairway 150, green 20ft, green 3ft") sg.hole(positions, par=4, vs="scratch")["total"] # 0.24 sg.hole(positions, par=4, vs=15)["total"] # 0.78 sg.round_total([h])["total"] sg.level_vs_scratch("putting", 15) # -2.05: strokes a round a 15 loses putting sg.plays_like_handicap(-2.3, [{"bucket": "putting"}]) # 17: losing 2.3 putting is a 17's putting Function What it gives you expected_strokes(position) PGA Tour expected strokes to hole out strokes_gained(start, end, holed=False, penalty_strokes=0) One shot against the Tour category(start, par=4) offTee, approach, aroundGreen (30 yards and in) or putting hole(positions, par=4, vs="tour", counts=None) Every shot on a hole, by category, with the total; vs is "tour" (the default), "scratch" or a handicap index round_total(holes) Holes added up shots_table(rows) A list of shot rows, grouped into holes, with expected, category and strokesGained added level_vs_scratch(bucket, handicap) Strokes per 18 holes a golfer of that handicap loses to scratch tour_vs_scratch(bucket) Strokes per 18 holes the average Tour player gains on scratch plays_like_handicap(sg_vs_scratch, buckets) The handicap a strokes-against-scratch number corresponds to baseline_shift(category, vs, counts=None) What one shot gains or loses moving from the Tour to vs parse_position(text), parse_hole(text) The command line's parser A position is a dict with a lie (tee, fairway, rough, sand or bunker, recovery, green) and one of yards, feet or meters. In hole(), a position's penaltyStrokes counts against the shot that ended there, so {"lie": "fairway", "yards": 60, "penaltyStrokes": 1} is a drop after a ball in the water. The handicap functions use Broadie's four parts of the game (longGame, shortGame, sand, putting), because that's how his amateur data is split. The package is typed, and the raw tables are strokes_gained.BASELINE.
pip install "strokes-gained[pandas]" import pandas as pd from strokes_gained.pandas import add_strokes_gained shots = pd.DataFrame([ {"hole": 1, "par": 4, "lie": "tee", "yards": 410}, {"hole": 1, "par": 4, "lie": "fairway", "yards": 150}, {"hole": 1, "par": 4, "lie": "green", "feet": 20}, {"hole": 1, "par": 4, "lie": "green", "feet": 3}, {"hole": 2, "par": 3, "lie": "tee", "yards": 180}, {"hole": 2, "par": 3, "lie": "green", "feet": 30}, {"hole": 2, "par": 3, "lie": "green", "feet": 2}, ]) add_strokes_gained(shots).groupby("category")["strokes_gained"].sum() # approach 0.15 # offTee 0.06 # putting -0.15 One row per shot, in playing order. Rows with the same hole are one hole, and the last row of each hole was holed. A row's empty distance columns are ignored, so yards and feet can share a table.
strokes-gained expected "150y fairway" # 2.95 strokes to hole out strokes-gained shot "150y fairway" "20ft green" # +0.08 strokes gained strokes-gained shot "3ft green" holed # +0.04 strokes-gained hole "tee 180, fairway 60 +1, green 8ft" --par 3 strokes-gained hole "tee 410, fairway 150, green 20ft, green 3ft" --vs 15 strokes-gained level 15 # what a 15 handicap loses to scratch A position is a distance and a lie in either order: 150y fairway, fairway 150, 20ft green, bunker 30 yards, 140m rough. Distances are in yards unless you say otherwise, and in feet on the green. A trailing +1 is a penalty stroke on the shot that ended there. A hole is measured against a scratch golfer unless you pass --vs tour or a handicap index (--vs 15); expected and shot are always against the Tour. Add --json to any command for JSON. The output matches the npm package's command line exactly.
What is a good strokes gained number?
Zero means a shot, round or part of your game matched the benchmark exactly. Against the PGA Tour baseline nearly every amateur is negative, so the useful comparison is against golfers at your level: a 15-handicap typically loses about 2 strokes a round putting to a scratch golfer, so losing 1 means your putting is ahead of your handicap. level_vs_scratch and plays_like_handicap do that comparison.
How many strokes does a 15-handicap lose to a scratch golfer?
About 14 a round: roughly 8 in the long game, 3 in the short game, half a stroke from bunkers and 2 putting. The table above has every level from 5 to 30.
Is strokes gained measured against the PGA Tour or a scratch golfer?
Either, or any handicap. The tables are the PGA Tour's, the standard reference. Measured against a scratch golfer, or a handicap like 10 or 15, the numbers say how a shot compares with golfers you'd actually play with, which is what the command line and the Claude and ChatGPT connector show by default.
Do I need sensors or a launch monitor to track strokes gained?
No. Strokes gained needs only where each shot started and finished. That can come from club sensors, from a notebook, or from what you say: Shotto works out strokes gained from shots you describe to your Apple Watch or iPhone.
Which golf apps calculate strokes gained?
Sensor-based trackers calculate it from shots their sensors tag, and some GPS apps from shots you tap in. Shotto calculates it from what you say about each shot, during the round or after it, so there's nothing to tap or attach. Shotto Golf is on the App Store for iPhone and Apple Watch.
Is there a JavaScript version?
Yes: npm install strokes-gained. It has the same functions and the same command line.
Where the numbers come from
Tee to green: Broadie (2011), "Assessing Golfer Performance on the PGA TOUR", Table 9: average strokes to hole out from about 8 million ShotLink shots, 2003 to 2010. Values between rows are interpolated in a straight line, and distances past either end take the end value.
Putting: the Tour expected-putts curve by distance, anchored to the paper's 1.80 from 16 feet.
Handicap levels: Broadie's Golfmetrics amateur data, by part of the game against scratch. The handicap given to each of his scoring groups (about 5, 17 and 30) is our estimate.
The Tour's edge on scratch: about 5.4 strokes a round (Every Shot Counts, 2014). How it splits between the parts of the game is our estimate.
These are Tour averages from one era, the standard reference for strokes gained.
This package passes the same 174 cases (tests/conformance.json) as the npm package and the Shotto app's Swift implementation. All three are generated from one copy of the tables.
Source, issues and both packages: github.com/shottogolf/strokes-gained.
MIT. Made by Shotto.
Shotto on the App Store
Released: Nov 28, 2026
Both files in this release have provenance metadata.
View provenance details
MIT View SPDX License List
broadie expected strokes golf golf analytics golf handicap golf stats handicap pandas pga tour shot tracking shotlink strokes gained strokes-gained
Development Status 4 - Beta
Intended Audience Developers
Programming Language Python :: 3
Topic Scientific/Engineering :: Information Analysis
Release files for strokes-gained 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
Built distribution (wheel)
Total release size: 41.3 kB
Release files / strokes_gained-0.2.0.tar.gz
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.
Release files / strokes_gained-0.2.0-py3-none-any.whl
Security for strokes-gained 0.2.0
Both files in this release have been uploaded with provenance metadata.
With provenance strokes_gained-0.2.0.tar.gz Nov 28, 2026
With provenance strokes_gained-0.2.0-py3-none-any.whl Nov 28, 2026
Attestation for strokes_gained-0.2.0.tar.gz
Attestation for strokes_gained-0.2.0-py3-none-any.whl
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.
Release history Release notifications | RSS feed
Nov 28, 2026 2 release files Full provenance
"PyPI", "Python Package Index", and the blocks logos are registered trademarks of the Python Software Foundation.
© 2026 Python Software Foundation
Deployed from fc0d8e6











