nfl-bigquery 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. nfl_bigquery/__init__.py +3 -0
  2. nfl_bigquery/_transform_util.py +19 -0
  3. nfl_bigquery/_version.py +1 -0
  4. nfl_bigquery/cli.py +145 -0
  5. nfl_bigquery/client.py +48 -0
  6. nfl_bigquery/dictionaries/pbp.csv +373 -0
  7. nfl_bigquery/dictionaries/player_stats.csv +49 -0
  8. nfl_bigquery/dictionaries/players.csv +40 -0
  9. nfl_bigquery/dictionaries/schedules.csv +46 -0
  10. nfl_bigquery/dictionary.py +72 -0
  11. nfl_bigquery/docs/__init__.py +0 -0
  12. nfl_bigquery/docs/renderers.py +76 -0
  13. nfl_bigquery/docs/taxonomy.py +41 -0
  14. nfl_bigquery/games/__init__.py +0 -0
  15. nfl_bigquery/games/schema.py +43 -0
  16. nfl_bigquery/games/transform.py +13 -0
  17. nfl_bigquery/partition.py +27 -0
  18. nfl_bigquery/players/__init__.py +0 -0
  19. nfl_bigquery/players/schema.py +19 -0
  20. nfl_bigquery/players/sync.py +27 -0
  21. nfl_bigquery/players/transform.py +10 -0
  22. nfl_bigquery/players/writer.py +61 -0
  23. nfl_bigquery/plays/__init__.py +0 -0
  24. nfl_bigquery/plays/enrichment.py +154 -0
  25. nfl_bigquery/plays/schema.py +18 -0
  26. nfl_bigquery/plays/transform.py +10 -0
  27. nfl_bigquery/runs.py +82 -0
  28. nfl_bigquery/schema.py +68 -0
  29. nfl_bigquery/stats/__init__.py +0 -0
  30. nfl_bigquery/stats/schema.py +25 -0
  31. nfl_bigquery/stats/transform.py +10 -0
  32. nfl_bigquery/sync.py +82 -0
  33. nfl_bigquery/verify/__init__.py +0 -0
  34. nfl_bigquery/verify/base.py +10 -0
  35. nfl_bigquery/verify/internal.py +116 -0
  36. nfl_bigquery/writer.py +120 -0
  37. nfl_bigquery-0.1.0.dist-info/METADATA +73 -0
  38. nfl_bigquery-0.1.0.dist-info/RECORD +41 -0
  39. nfl_bigquery-0.1.0.dist-info/WHEEL +4 -0
  40. nfl_bigquery-0.1.0.dist-info/entry_points.txt +2 -0
  41. nfl_bigquery-0.1.0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,3 @@
1
+ from nfl_bigquery._version import __version__
2
+
3
+ __all__ = ["__version__"]
@@ -0,0 +1,19 @@
1
+ """Shared transform helper: reindex to schema columns + stamp ingested_at."""
2
+ from __future__ import annotations
3
+
4
+ from datetime import UTC, datetime
5
+
6
+ import pandas as pd
7
+
8
+ from nfl_bigquery.schema import ColumnSpec, spec_names
9
+
10
+
11
+ def align_to_schema(
12
+ df: pd.DataFrame, schema: list[ColumnSpec], *, stamp: bool = True
13
+ ) -> pd.DataFrame:
14
+ df = df.copy()
15
+ if stamp:
16
+ df["ingested_at"] = datetime.now(UTC)
17
+ cols = spec_names(schema)
18
+ # Reindex adds missing NULLABLE columns as NA and drops columns not in schema.
19
+ return df.reindex(columns=cols)
@@ -0,0 +1 @@
1
+ __version__ = "0.1.0"
nfl_bigquery/cli.py ADDED
@@ -0,0 +1,145 @@
1
+ """nfl-bigquery CLI entrypoint."""
2
+ from __future__ import annotations
3
+
4
+ import argparse
5
+ import logging
6
+
7
+ from nfl_bigquery._version import __version__
8
+
9
+
10
+ def build_parser() -> argparse.ArgumentParser:
11
+ parser = argparse.ArgumentParser(prog="nfl-bigquery")
12
+ parser.add_argument("--version", action="version", version=__version__)
13
+ sub = parser.add_subparsers(dest="command")
14
+
15
+ sy = sub.add_parser("sync", help="Fetch nflverse data and write to BigQuery")
16
+ sy.add_argument("--seasons", required=True,
17
+ help="e.g. 1999-2025 | 2023,2025 | 2024 | latest")
18
+ sy.add_argument("--pbp-table", required=True, help="project.dataset.nfl_plays")
19
+ sy.add_argument("--games-table")
20
+ sy.add_argument("--weekly-stats-table")
21
+ sy.add_argument("--runs-table")
22
+ sy.add_argument("--skip-games", action="store_true")
23
+ sy.add_argument("--skip-weekly-stats", action="store_true")
24
+ sy.add_argument("--resume", action="store_true")
25
+ sy.add_argument("--dry-run", action="store_true")
26
+
27
+ pl = sub.add_parser("players", help="Upsert the dim_players dimension")
28
+ pl.add_argument("--players-table", required=True, help="project.dataset.dim_players")
29
+ pl.add_argument("--dry-run", action="store_true")
30
+
31
+ dc = sub.add_parser("docs", help="Render table documentation")
32
+ dc.add_argument("--format", required=True,
33
+ choices=["bq-apply", "llm", "dictionary", "markdown", "dbt"])
34
+ dc.add_argument("--table", help="project.dataset.table (required for bq-apply)")
35
+ dc.add_argument("--output", default="-", help="output path or - for stdout")
36
+
37
+ vf = sub.add_parser("verify", help="Run data-quality checks")
38
+ vf.add_argument("--source", default="internal", choices=["internal"])
39
+ vf.add_argument("--season", type=int, required=True)
40
+ vf.add_argument("--pbp-table", required=True)
41
+ vf.add_argument("--games-table")
42
+ vf.add_argument("--weekly-stats-table")
43
+ vf.add_argument("--tolerance", type=float, default=1.0)
44
+
45
+ return parser
46
+
47
+
48
+ def main(argv: list[str] | None = None) -> int:
49
+ logging.basicConfig(level=logging.INFO, format="%(levelname)s %(name)s: %(message)s")
50
+ parser = build_parser()
51
+ ns = parser.parse_args(argv)
52
+ if not getattr(ns, "command", None):
53
+ parser.print_help()
54
+ return 0
55
+ if ns.command == "sync":
56
+ from google.cloud import bigquery
57
+
58
+ from nfl_bigquery.client import NflverseClient
59
+ from nfl_bigquery.runs import RunsTable
60
+ from nfl_bigquery.sync import run_sync
61
+ from nfl_bigquery.writer import BigQueryWriter
62
+
63
+ bq = bigquery.Client()
64
+ return run_sync(ns, client=NflverseClient(), writer=BigQueryWriter(client=bq),
65
+ runs=RunsTable(client=bq))
66
+ if ns.command == "players":
67
+ from google.cloud import bigquery
68
+
69
+ from nfl_bigquery.client import NflverseClient
70
+ from nfl_bigquery.players.sync import run_players
71
+
72
+ return run_players(ns, client=NflverseClient(), bq_client=bigquery.Client())
73
+ if ns.command == "docs":
74
+ from nfl_bigquery.docs.renderers import (
75
+ render_bq_apply,
76
+ render_dbt,
77
+ render_dictionary_rows,
78
+ render_llm,
79
+ render_markdown,
80
+ )
81
+ from nfl_bigquery.docs.taxonomy import TABLES
82
+
83
+ if ns.format == "llm":
84
+ text = render_llm(TABLES)
85
+ elif ns.format == "markdown":
86
+ text = render_markdown(TABLES)
87
+ elif ns.format == "dbt":
88
+ text = render_dbt(TABLES)
89
+ elif ns.format == "bq-apply":
90
+ if not ns.table:
91
+ parser.error("--table is required for --format bq-apply")
92
+ from google.cloud import bigquery
93
+
94
+ bq = bigquery.Client()
95
+ table_name = ns.table.split(".")[-1]
96
+ if table_name not in TABLES:
97
+ parser.error(f"unknown table '{table_name}'; choices: {sorted(TABLES)}")
98
+ desc = {n: d for n, d in render_bq_apply(table_name)}
99
+ fetched = bq.get_table(ns.table)
100
+ new_schema = [
101
+ bigquery.SchemaField(
102
+ f.name, f.field_type, mode=f.mode,
103
+ description=desc.get(f.name, f.description or ""),
104
+ )
105
+ for f in fetched.schema
106
+ ]
107
+ fetched.schema = new_schema
108
+ bq.update_table(fetched, ["schema"])
109
+ print(f"applied descriptions to {ns.table}")
110
+ return 0
111
+ else: # dictionary
112
+ import json
113
+
114
+ text = json.dumps(render_dictionary_rows(TABLES), indent=2)
115
+ if ns.output == "-":
116
+ print(text)
117
+ else:
118
+ from pathlib import Path
119
+
120
+ Path(ns.output).write_text(text, encoding="utf-8")
121
+ return 0
122
+ if ns.command == "verify":
123
+ from google.cloud import bigquery
124
+
125
+ from nfl_bigquery.verify.internal import run_internal
126
+ from nfl_bigquery.writer import TableRef
127
+
128
+ pbp = TableRef.parse(ns.pbp_table)
129
+ games = ns.games_table or f"{pbp.project}.{pbp.dataset}.games"
130
+ stats = ns.weekly_stats_table or f"{pbp.project}.{pbp.dataset}.weekly_player_stats"
131
+ results = run_internal(
132
+ bigquery.Client(), plays_ref=str(pbp), games_ref=games, stats_ref=stats,
133
+ season=ns.season, tolerance=ns.tolerance)
134
+ failed = 0
135
+ for r in results:
136
+ mark = "PASS" if r.passed else "FAIL"
137
+ print(f"[{mark}] {r.name}: {r.detail}")
138
+ if not r.passed:
139
+ failed += 1
140
+ return 1 if failed else 0
141
+ return 0
142
+
143
+
144
+ if __name__ == "__main__":
145
+ raise SystemExit(main())
nfl_bigquery/client.py ADDED
@@ -0,0 +1,48 @@
1
+ # nfl_bigquery/client.py
2
+ """Thin nflreadpy wrapper: fetch a season's parquet, convert to pandas, retry."""
3
+ from __future__ import annotations
4
+
5
+ import logging
6
+ import time
7
+
8
+ import nflreadpy as nfl
9
+ import pandas as pd
10
+
11
+ log = logging.getLogger(__name__)
12
+
13
+
14
+ class NflverseClient:
15
+ def __init__(self, max_retries: int = 5, backoff_seconds: float = 2.0) -> None:
16
+ self.max_retries = max_retries
17
+ self.backoff_seconds = backoff_seconds
18
+
19
+ def _retry(self, fn, *args) -> pd.DataFrame:
20
+ last: Exception | None = None
21
+ for attempt in range(1, self.max_retries + 1):
22
+ try:
23
+ return fn(*args).to_pandas()
24
+ except Exception as e: # noqa: BLE001 - retry any transient download error
25
+ last = e
26
+ wait = self.backoff_seconds * (2 ** (attempt - 1))
27
+ log.warning(
28
+ "nflverse load failed (attempt %d/%d): %s; retrying in %.1fs",
29
+ attempt,
30
+ self.max_retries,
31
+ e,
32
+ wait,
33
+ )
34
+ if attempt < self.max_retries:
35
+ time.sleep(wait)
36
+ raise RuntimeError(f"nflverse load failed after {self.max_retries} attempts") from last
37
+
38
+ def load_pbp(self, season: int) -> pd.DataFrame:
39
+ return self._retry(nfl.load_pbp, [season])
40
+
41
+ def load_schedules(self, season: int) -> pd.DataFrame:
42
+ return self._retry(nfl.load_schedules, [season])
43
+
44
+ def load_player_stats(self, season: int) -> pd.DataFrame:
45
+ return self._retry(nfl.load_player_stats, [season])
46
+
47
+ def load_players(self) -> pd.DataFrame:
48
+ return self._retry(nfl.load_players)
@@ -0,0 +1,373 @@
1
+ field,description,type
2
+ play_id,Numeric play id that when used with game_id and drive provides the unique identifier for a single play.,numeric
3
+ game_id,Ten digit identifier for NFL game.,character
4
+ old_game_id,Legacy NFL game ID.,character
5
+ home_team,String abbreviation for the home team.,character
6
+ away_team,String abbreviation for the away team.,character
7
+ season_type,'REG' or 'POST' indicating if the game belongs to regular or post season.,character
8
+ week,Season week.,integer
9
+ posteam,String abbreviation for the team with possession.,character
10
+ posteam_type,String indicating whether the posteam team is home or away.,character
11
+ defteam,String abbreviation for the team on defense.,character
12
+ side_of_field,String abbreviation for which team's side of the field the team with possession is currently on.,character
13
+ yardline_100,Numeric distance in the number of yards from the opponent's endzone for the posteam.,numeric
14
+ game_date,Date of the game.,character
15
+ quarter_seconds_remaining,Numeric seconds remaining in the quarter.,numeric
16
+ half_seconds_remaining,Numeric seconds remaining in the half.,numeric
17
+ game_seconds_remaining,Numeric seconds remaining in the game.,numeric
18
+ game_half,"String indicating which half the play is in, either Half1, Half2, or Overtime.",character
19
+ quarter_end,Binary indicator for whether or not the row of the data is marking the end of a quarter.,numeric
20
+ drive,Numeric drive number in the game.,numeric
21
+ sp,Binary indicator for whether or not a score occurred on the play.,numeric
22
+ qtr,Quarter of the game (5 is overtime).,numeric
23
+ down,The down for the given play.,numeric
24
+ goal_to_go,Binary indicator for whether or not the posteam is in a goal down situation.,integer
25
+ time,Time at start of play provided in string format as minutes:seconds remaining in the quarter.,character
26
+ yrdln,String indicating the current field position for a given play.,character
27
+ ydstogo,Numeric yards in distance from either the first down marker or the endzone in goal down situations.,numeric
28
+ ydsnet,Numeric value for total yards gained on the given drive.,numeric
29
+ desc,Detailed string description for the given play.,character
30
+ play_type,"String indicating the type of play: pass (includes sacks), run (includes scrambles), punt, field_goal, kickoff, extra_point, qb_kneel, qb_spike, no_play (timeouts and penalties), and missing for rows indicating end of play.",character
31
+ yards_gained,"Numeric yards gained (or lost) by the possessing team, excluding yards gained via fumble recoveries and laterals.",numeric
32
+ shotgun,Binary indicator for whether or not the play was in shotgun formation.,numeric
33
+ no_huddle,Binary indicator for whether or not the play was in no_huddle formation.,numeric
34
+ qb_dropback,"Binary indicator for whether or not the QB dropped back on the play (pass attempt, sack, or scrambled).",numeric
35
+ qb_kneel,Binary indicator for whether or not the QB took a knee.,numeric
36
+ qb_spike,Binary indicator for whether or not the QB spiked the ball.,numeric
37
+ qb_scramble,Binary indicator for whether or not the QB scrambled.,numeric
38
+ pass_length,String indicator for pass length: short or deep.,character
39
+ pass_location,"String indicator for pass location: left, middle, or right.",character
40
+ air_yards,Numeric value for distance in yards perpendicular to the line of scrimmage at where the targeted receiver either caught or didn't catch the ball.,numeric
41
+ yards_after_catch,Numeric value for distance in yards perpendicular to the yard line where the receiver made the reception to where the play ended.,numeric
42
+ run_location,"String indicator for location of run: left, middle, or right.",character
43
+ run_gap,"String indicator for line gap of run: end, guard, or tackle",character
44
+ field_goal_result,"String indicator for result of field goal attempt: made, missed, or blocked.",character
45
+ kick_distance,"Numeric distance in yards for kickoffs, field goals, and punts.",numeric
46
+ extra_point_result,"String indicator for the result of the extra point attempt: good, failed, blocked, safety (touchback in defensive endzone is 1 point apparently), or aborted.",character
47
+ two_point_conv_result,"String indicator for result of two point conversion attempt: success, failure, safety (touchback in defensive endzone is 1 point apparently), or return.",character
48
+ home_timeouts_remaining,Numeric timeouts remaining in the half for the home team.,numeric
49
+ away_timeouts_remaining,Numeric timeouts remaining in the half for the away team.,numeric
50
+ timeout,Binary indicator for whether or not a timeout was called by either team.,numeric
51
+ timeout_team,String abbreviation for which team called the timeout.,character
52
+ td_team,String abbreviation for which team scored the touchdown.,character
53
+ td_player_name,String name of the player who scored a touchdown.,character
54
+ td_player_id,Unique identifier of the player who scored a touchdown.,character
55
+ posteam_timeouts_remaining,Number of timeouts remaining for the possession team.,numeric
56
+ defteam_timeouts_remaining,Number of timeouts remaining for the team on defense.,numeric
57
+ total_home_score,Score for the home team at the start of the play.,numeric
58
+ total_away_score,Score for the away team at the start of the play.,numeric
59
+ posteam_score,Score the posteam at the start of the play.,numeric
60
+ defteam_score,Score the defteam at the start of the play.,numeric
61
+ score_differential,Score differential between the posteam and defteam at the start of the play.,numeric
62
+ posteam_score_post,Score for the posteam at the end of the play.,numeric
63
+ defteam_score_post,Score for the defteam at the end of the play.,numeric
64
+ score_differential_post,Score differential between the posteam and defteam at the end of the play.,numeric
65
+ no_score_prob,Predicted probability of no score occurring for the rest of the half based on the expected points model.,numeric
66
+ opp_fg_prob,Predicted probability of the defteam scoring a FG next. 'Next' in this context means the next score in the same game half.,numeric
67
+ opp_safety_prob,Predicted probability of the defteam scoring a safety next. 'Next' in this context means the next score in the same game half.,numeric
68
+ opp_td_prob,Predicted probability of the defteam scoring a TD next. 'Next' in this context means the next score in the same game half.,numeric
69
+ fg_prob,Predicted probability of the posteam scoring a FG next. 'Next' in this context means the next score in the same game half.,numeric
70
+ safety_prob,Predicted probability of the posteam scoring a safety next. 'Next' in this context means the next score in the same game half.,numeric
71
+ td_prob,Predicted probability of the posteam scoring a TD next. 'Next' in this context means the next score in the same game half.,numeric
72
+ extra_point_prob,Predicted probability of the posteam scoring an extra point.,numeric
73
+ two_point_conversion_prob,Predicted probability of the posteam scoring the two point conversion.,numeric
74
+ ep,"Using the scoring event probabilities, the estimated expected points with respect to the possession team for the given play.",numeric
75
+ epa,Expected points added (EPA) by the posteam for the given play.,numeric
76
+ total_home_epa,Cumulative total EPA for the home team in the game so far.,numeric
77
+ total_away_epa,Cumulative total EPA for the away team in the game so far.,numeric
78
+ total_home_rush_epa,Cumulative total rushing EPA for the home team in the game so far.,numeric
79
+ total_away_rush_epa,Cumulative total rushing EPA for the away team in the game so far.,numeric
80
+ total_home_pass_epa,Cumulative total passing EPA for the home team in the game so far.,numeric
81
+ total_away_pass_epa,Cumulative total passing EPA for the away team in the game so far.,numeric
82
+ air_epa,EPA from the air yards alone. For completions this represents the actual value provided through the air. For incompletions this represents the hypothetical value that could've been added through the air if the pass was completed.,numeric
83
+ yac_epa,EPA from the yards after catch alone. For completions this represents the actual value provided after the catch. For incompletions this represents the difference between the hypothetical air_epa and the play's raw observed EPA (how much the incomplete pass cost the posteam).,numeric
84
+ comp_air_epa,EPA from the air yards alone only for completions.,numeric
85
+ comp_yac_epa,EPA from the yards after catch alone only for completions.,numeric
86
+ total_home_comp_air_epa,Cumulative total completions air EPA for the home team in the game so far.,numeric
87
+ total_away_comp_air_epa,Cumulative total completions air EPA for the away team in the game so far.,numeric
88
+ total_home_comp_yac_epa,Cumulative total completions yac EPA for the home team in the game so far.,numeric
89
+ total_away_comp_yac_epa,Cumulative total completions yac EPA for the away team in the game so far.,numeric
90
+ total_home_raw_air_epa,Cumulative total raw air EPA for the home team in the game so far.,numeric
91
+ total_away_raw_air_epa,Cumulative total raw air EPA for the away team in the game so far.,numeric
92
+ total_home_raw_yac_epa,Cumulative total raw yac EPA for the home team in the game so far.,numeric
93
+ total_away_raw_yac_epa,Cumulative total raw yac EPA for the away team in the game so far.,numeric
94
+ wp,Estimated win probabiity for the posteam given the current situation at the start of the given play.,numeric
95
+ def_wp,Estimated win probability for the defteam.,numeric
96
+ home_wp,Estimated win probability for the home team.,numeric
97
+ away_wp,Estimated win probability for the away team.,numeric
98
+ wpa,Win probability added (WPA) for the posteam.,numeric
99
+ vegas_wpa,Win probability added (WPA) for the posteam: spread_adjusted model.,numeric
100
+ vegas_home_wpa,Win probability added (WPA) for the home team: spread_adjusted model.,numeric
101
+ home_wp_post,Estimated win probability for the home team at the end of the play.,numeric
102
+ away_wp_post,Estimated win probability for the away team at the end of the play.,numeric
103
+ vegas_wp,"Estimated win probabiity for the posteam given the current situation at the start of the given play, incorporating pre-game Vegas line.",numeric
104
+ vegas_home_wp,Estimated win probability for the home team incorporating pre-game Vegas line.,numeric
105
+ total_home_rush_wpa,Cumulative total rushing WPA for the home team in the game so far.,numeric
106
+ total_away_rush_wpa,Cumulative total rushing WPA for the away team in the game so far.,numeric
107
+ total_home_pass_wpa,Cumulative total passing WPA for the home team in the game so far.,numeric
108
+ total_away_pass_wpa,Cumulative total passing WPA for the away team in the game so far.,numeric
109
+ air_wpa,WPA through the air (same logic as air_epa).,numeric
110
+ yac_wpa,WPA from yards after the catch (same logic as yac_epa).,numeric
111
+ comp_air_wpa,The air_wpa for completions only.,numeric
112
+ comp_yac_wpa,The yac_wpa for completions only.,numeric
113
+ total_home_comp_air_wpa,Cumulative total completions air WPA for the home team in the game so far.,numeric
114
+ total_away_comp_air_wpa,Cumulative total completions air WPA for the away team in the game so far.,numeric
115
+ total_home_comp_yac_wpa,Cumulative total completions yac WPA for the home team in the game so far.,numeric
116
+ total_away_comp_yac_wpa,Cumulative total completions yac WPA for the away team in the game so far.,numeric
117
+ total_home_raw_air_wpa,Cumulative total raw air WPA for the home team in the game so far.,numeric
118
+ total_away_raw_air_wpa,Cumulative total raw air WPA for the away team in the game so far.,numeric
119
+ total_home_raw_yac_wpa,Cumulative total raw yac WPA for the home team in the game so far.,numeric
120
+ total_away_raw_yac_wpa,Cumulative total raw yac WPA for the away team in the game so far.,numeric
121
+ punt_blocked,Binary indicator for if the punt was blocked.,numeric
122
+ first_down_rush,Binary indicator for if a running play converted the first down.,numeric
123
+ first_down_pass,Binary indicator for if a passing play converted the first down.,numeric
124
+ first_down_penalty,Binary indicator for if a penalty converted the first down.,numeric
125
+ third_down_converted,Binary indicator for if the first down was converted on third down.,numeric
126
+ third_down_failed,Binary indicator for if the posteam failed to convert first down on third down.,numeric
127
+ fourth_down_converted,Binary indicator for if the first down was converted on fourth down.,numeric
128
+ fourth_down_failed,Binary indicator for if the posteam failed to convert first down on fourth down.,numeric
129
+ incomplete_pass,Binary indicator for if the pass was incomplete.,numeric
130
+ touchback,Binary indicator for if a touchback occurred on the play.,numeric
131
+ interception,Binary indicator for if the pass was intercepted.,numeric
132
+ punt_inside_twenty,Binary indicator for if the punt ended inside the twenty yard line.,numeric
133
+ punt_in_endzone,Binary indicator for if the punt was in the endzone.,numeric
134
+ punt_out_of_bounds,Binary indicator for if the punt went out of bounds.,numeric
135
+ punt_downed,Binary indicator for if the punt was downed.,numeric
136
+ punt_fair_catch,Binary indicator for if the punt was caught with a fair catch.,numeric
137
+ kickoff_inside_twenty,Binary indicator for if the kickoff ended inside the twenty yard line.,numeric
138
+ kickoff_in_endzone,Binary indicator for if the kickoff was in the endzone.,numeric
139
+ kickoff_out_of_bounds,Binary indicator for if the kickoff went out of bounds.,numeric
140
+ kickoff_downed,Binary indicator for if the kickoff was downed.,numeric
141
+ kickoff_fair_catch,Binary indicator for if the kickoff was caught with a fair catch.,numeric
142
+ fumble_forced,Binary indicator for if the fumble was forced.,numeric
143
+ fumble_not_forced,Binary indicator for if the fumble was not forced.,numeric
144
+ fumble_out_of_bounds,Binary indicator for if the fumble went out of bounds.,numeric
145
+ solo_tackle,Binary indicator if the play had a solo tackle (could be multiple due to fumbles).,numeric
146
+ safety,Binary indicator for whether or not a safety occurred.,numeric
147
+ penalty,Binary indicator for whether or not a penalty occurred.,numeric
148
+ tackled_for_loss,Binary indicator for whether or not a tackle for loss on a run play occurred.,numeric
149
+ fumble_lost,Binary indicator for if the fumble was lost.,numeric
150
+ own_kickoff_recovery,Binary indicator for if the kicking team recovered the kickoff.,numeric
151
+ own_kickoff_recovery_td,Binary indicator for if the kicking team recovered the kickoff and scored a TD.,numeric
152
+ qb_hit,Binary indicator if the QB was hit on the play.,numeric
153
+ rush_attempt,Binary indicator for if the play was a run.,numeric
154
+ pass_attempt,Binary indicator for if the play was a pass attempt (includes sacks).,numeric
155
+ sack,Binary indicator for if the play ended in a sack.,numeric
156
+ touchdown,Binary indicator for if the play resulted in a TD.,numeric
157
+ pass_touchdown,Binary indicator for if the play resulted in a passing TD.,numeric
158
+ rush_touchdown,Binary indicator for if the play resulted in a rushing TD.,numeric
159
+ return_touchdown,"Binary indicator for if the play resulted in a return TD. Returns may occur on any of: interception, fumble, kickoff, punt, or blocked kicks.",numeric
160
+ extra_point_attempt,Binary indicator for extra point attempt.,numeric
161
+ two_point_attempt,Binary indicator for two point conversion attempt.,numeric
162
+ field_goal_attempt,Binary indicator for field goal attempt.,numeric
163
+ kickoff_attempt,Binary indicator for kickoff.,numeric
164
+ punt_attempt,Binary indicator for punts.,numeric
165
+ fumble,Binary indicator for if a fumble occurred.,numeric
166
+ complete_pass,Binary indicator for if the pass was completed.,numeric
167
+ assist_tackle,Binary indicator for if an assist tackle occurred.,numeric
168
+ lateral_reception,Binary indicator for if a lateral occurred on the reception.,numeric
169
+ lateral_rush,Binary indicator for if a lateral occurred on a run.,numeric
170
+ lateral_return,"Binary indicator for if a lateral occurred on a return. Returns may occur on any of: interception, fumble, kickoff, punt, or blocked kicks.",numeric
171
+ lateral_recovery,Binary indicator for if a lateral occurred on a fumble recovery.,numeric
172
+ passer_player_id,Unique identifier for the player that attempted the pass.,character
173
+ passer_player_name,String name for the player that attempted the pass.,character
174
+ passing_yards,"Numeric yards by the passer_player_name, including yards gained in pass plays with laterals. This should equal official passing statistics.",numeric
175
+ receiver_player_id,Unique identifier for the receiver that was targeted on the pass.,character
176
+ receiver_player_name,String name for the targeted receiver.,character
177
+ receiving_yards,"Numeric yards by the receiver_player_name, excluding yards gained in pass plays with laterals. This should equal official receiving statistics but could miss yards gained in pass plays with laterals. Please see the description of `lateral_receiver_player_name` for further information.",numeric
178
+ rusher_player_id,Unique identifier for the player that attempted the run.,character
179
+ rusher_player_name,String name for the player that attempted the run.,character
180
+ rushing_yards,"Numeric yards by the rusher_player_name, excluding yards gained in rush plays with laterals. This should equal official rushing statistics but could miss yards gained in rush plays with laterals. Please see the description of `lateral_rusher_player_name` for further information.",numeric
181
+ lateral_receiver_player_id,Unique identifier for the player that received the last(!) lateral on a pass play.,character
182
+ lateral_receiver_player_name,"String name for the player that received the last(!) lateral on a pass play. If there were multiple laterals in the same play, this will only be the last player who received a lateral. Please see <https://github.com/mrcaseb/nfl-data/tree/master/data/lateral_yards> for a list of plays where multiple players recorded lateral receiving yards.",character
183
+ lateral_receiving_yards,Numeric yards by the `lateral_receiver_player_name` in pass plays with laterals. Please see the description of `lateral_receiver_player_name` for further information.,numeric
184
+ lateral_rusher_player_id,Unique identifier for the player that received the last(!) lateral on a run play.,character
185
+ lateral_rusher_player_name,"String name for the player that received the last(!) lateral on a run play. If there were multiple laterals in the same play, this will only be the last player who received a lateral. Please see <https://github.com/mrcaseb/nfl-data/tree/master/data/lateral_yards> for a list of plays where multiple players recorded lateral rushing yards.",character
186
+ lateral_rushing_yards,Numeric yards by the `lateral_rusher_player_name` in run plays with laterals. Please see the description of `lateral_rusher_player_name` for further information.,numeric
187
+ lateral_sack_player_id,Unique identifier for the player that received the lateral on a sack.,character
188
+ lateral_sack_player_name,String name for the player that received the lateral on a sack.,character
189
+ interception_player_id,Unique identifier for the player that intercepted the pass.,character
190
+ interception_player_name,String name for the player that intercepted the pass.,character
191
+ lateral_interception_player_id,Unique indentifier for the player that received the lateral on an interception.,character
192
+ lateral_interception_player_name,String name for the player that received the lateral on an interception.,character
193
+ punt_returner_player_id,Unique identifier for the punt returner.,character
194
+ punt_returner_player_name,String name for the punt returner.,character
195
+ lateral_punt_returner_player_id,Unique identifier for the player that received the lateral on a punt return.,character
196
+ lateral_punt_returner_player_name,String name for the player that received the lateral on a punt return.,character
197
+ kickoff_returner_player_name,String name for the kickoff returner.,character
198
+ kickoff_returner_player_id,Unique identifier for the kickoff returner.,character
199
+ lateral_kickoff_returner_player_id,Unique identifier for the player that received the lateral on a kickoff return.,character
200
+ lateral_kickoff_returner_player_name,String name for the player that received the lateral on a kickoff return.,character
201
+ punter_player_id,Unique identifier for the punter.,character
202
+ punter_player_name,String name for the punter.,character
203
+ kicker_player_name,String name for the kicker on FG or kickoff.,character
204
+ kicker_player_id,Unique identifier for the kicker on FG or kickoff.,character
205
+ own_kickoff_recovery_player_id,Unique identifier for the player that recovered their own kickoff.,character
206
+ own_kickoff_recovery_player_name,String name for the player that recovered their own kickoff.,character
207
+ blocked_player_id,Unique identifier for the player that blocked the punt or FG.,character
208
+ blocked_player_name,String name for the player that blocked the punt or FG.,character
209
+ tackle_for_loss_1_player_id,Unique identifier for one of the potential players with the tackle for loss.,character
210
+ tackle_for_loss_1_player_name,String name for one of the potential players with the tackle for loss.,character
211
+ tackle_for_loss_2_player_id,Unique identifier for one of the potential players with the tackle for loss.,character
212
+ tackle_for_loss_2_player_name,String name for one of the potential players with the tackle for loss.,character
213
+ qb_hit_1_player_id,Unique identifier for one of the potential players that hit the QB. No sack as the QB was not the ball carrier. For sacks please see `sack_player` or `half_sack_*_player`.,character
214
+ qb_hit_1_player_name,String name for one of the potential players that hit the QB. No sack as the QB was not the ball carrier. For sacks please see `sack_player` or `half_sack_*_player`.,character
215
+ qb_hit_2_player_id,Unique identifier for one of the potential players that hit the QB. No sack as the QB was not the ball carrier. For sacks please see `sack_player` or `half_sack_*_player`.,character
216
+ qb_hit_2_player_name,String name for one of the potential players that hit the QB. No sack as the QB was not the ball carrier. For sacks please see `sack_player` or `half_sack_*_player`.,character
217
+ forced_fumble_player_1_team,Team of one of the players with a forced fumble.,character
218
+ forced_fumble_player_1_player_id,Unique identifier of one of the players with a forced fumble.,character
219
+ forced_fumble_player_1_player_name,String name of one of the players with a forced fumble.,character
220
+ forced_fumble_player_2_team,Team of one of the players with a forced fumble.,character
221
+ forced_fumble_player_2_player_id,Unique identifier of one of the players with a forced fumble.,character
222
+ forced_fumble_player_2_player_name,String name of one of the players with a forced fumble.,character
223
+ solo_tackle_1_team,Team of one of the players with a solo tackle.,character
224
+ solo_tackle_2_team,Team of one of the players with a solo tackle.,character
225
+ solo_tackle_1_player_id,Unique identifier of one of the players with a solo tackle.,character
226
+ solo_tackle_2_player_id,Unique identifier of one of the players with a solo tackle.,character
227
+ solo_tackle_1_player_name,String name of one of the players with a solo tackle.,character
228
+ solo_tackle_2_player_name,String name of one of the players with a solo tackle.,character
229
+ assist_tackle_1_player_id,Unique identifier of one of the players with a tackle assist.,character
230
+ assist_tackle_1_player_name,String name of one of the players with a tackle assist.,character
231
+ assist_tackle_1_team,Team of one of the players with a tackle assist.,character
232
+ assist_tackle_2_player_id,Unique identifier of one of the players with a tackle assist.,character
233
+ assist_tackle_2_player_name,String name of one of the players with a tackle assist.,character
234
+ assist_tackle_2_team,Team of one of the players with a tackle assist.,character
235
+ assist_tackle_3_player_id,Unique identifier of one of the players with a tackle assist.,character
236
+ assist_tackle_3_player_name,String name of one of the players with a tackle assist.,character
237
+ assist_tackle_3_team,Team of one of the players with a tackle assist.,character
238
+ assist_tackle_4_player_id,Unique identifier of one of the players with a tackle assist.,character
239
+ assist_tackle_4_player_name,String name of one of the players with a tackle assist.,character
240
+ assist_tackle_4_team,Team of one of the players with a tackle assist.,character
241
+ tackle_with_assist,Binary indicator for if there has been a tackle with assist.,numeric
242
+ tackle_with_assist_1_player_id,Unique identifier of one of the players with a tackle with assist.,character
243
+ tackle_with_assist_1_player_name,String name of one of the players with a tackle with assist.,character
244
+ tackle_with_assist_1_team,Team of one of the players with a tackle with assist.,character
245
+ tackle_with_assist_2_player_id,Unique identifier of one of the players with a tackle with assist.,character
246
+ tackle_with_assist_2_player_name,String name of one of the players with a tackle with assist.,character
247
+ tackle_with_assist_2_team,Team of one of the players with a tackle with assist.,character
248
+ pass_defense_1_player_id,Unique identifier of one of the players with a pass defense.,character
249
+ pass_defense_1_player_name,String name of one of the players with a pass defense.,character
250
+ pass_defense_2_player_id,Unique identifier of one of the players with a pass defense.,character
251
+ pass_defense_2_player_name,String name of one of the players with a pass defense.,character
252
+ fumbled_1_team,Team of one of the first player with a fumble.,character
253
+ fumbled_1_player_id,Unique identifier of the first player who fumbled on the play.,character
254
+ fumbled_1_player_name,String name of one of the first player who fumbled on the play.,character
255
+ fumbled_2_player_id,Unique identifier of the second player who fumbled on the play.,character
256
+ fumbled_2_player_name,String name of one of the second player who fumbled on the play.,character
257
+ fumbled_2_team,Team of one of the second player with a fumble.,character
258
+ fumble_recovery_1_team,Team of one of the players with a fumble recovery.,character
259
+ fumble_recovery_1_yards,Yards gained by one of the players with a fumble recovery.,numeric
260
+ fumble_recovery_1_player_id,Unique identifier of one of the players with a fumble recovery.,character
261
+ fumble_recovery_1_player_name,String name of one of the players with a fumble recovery.,character
262
+ fumble_recovery_2_team,Team of one of the players with a fumble recovery.,character
263
+ fumble_recovery_2_yards,Yards gained by one of the players with a fumble recovery.,numeric
264
+ fumble_recovery_2_player_id,Unique identifier of one of the players with a fumble recovery.,character
265
+ fumble_recovery_2_player_name,String name of one of the players with a fumble recovery.,character
266
+ sack_player_id,Unique identifier of the player who recorded a solo sack.,character
267
+ sack_player_name,String name of the player who recorded a solo sack.,character
268
+ half_sack_1_player_id,Unique identifier of the first player who recorded half a sack.,character
269
+ half_sack_1_player_name,String name of the first player who recorded half a sack.,character
270
+ half_sack_2_player_id,Unique identifier of the second player who recorded half a sack.,character
271
+ half_sack_2_player_name,String name of the second player who recorded half a sack.,character
272
+ return_team,"String abbreviation of the return team. Returns may occur on any of: interception, fumble, kickoff, punt, or blocked kicks.",character
273
+ return_yards,"Yards gained by the return team. Returns may occur on any of: interception, fumble, kickoff, punt, or blocked kicks.",numeric
274
+ penalty_team,String abbreviation of the team with the penalty.,character
275
+ penalty_player_id,Unique identifier for the player with the penalty.,character
276
+ penalty_player_name,String name for the player with the penalty.,character
277
+ penalty_yards,Yards gained (or lost) by the posteam from the penalty.,numeric
278
+ replay_or_challenge,Binary indicator for whether or not a replay or challenge.,numeric
279
+ replay_or_challenge_result,String indicating the result of the replay or challenge.,character
280
+ penalty_type,String indicating the penalty type of the first penalty in the given play. Will be `NA` if `desc` is missing the type.,character
281
+ defensive_two_point_attempt,"Binary indicator whether or not the defense was able to have an attempt on a two point conversion, this results following a turnover.",numeric
282
+ defensive_two_point_conv,Binary indicator whether or not the defense successfully scored on the two point conversion.,numeric
283
+ defensive_extra_point_attempt,"Binary indicator whether or not the defense was able to have an attempt on an extra point attempt, this results following a blocked attempt that the defense recovers the ball.",numeric
284
+ defensive_extra_point_conv,Binary indicator whether or not the defense successfully scored on an extra point attempt.,numeric
285
+ safety_player_name,String name for the player who scored a safety.,character
286
+ safety_player_id,Unique identifier for the player who scored a safety.,character
287
+ season,4 digit number indicating to which season the game belongs to.,integer
288
+ cp,Numeric value indicating the probability for a complete pass based on comparable game situations.,numeric
289
+ cpoe,For a single pass play this is 1 - cp when the pass was completed or 0 - cp when the pass was incomplete. Analyzed for a whole game or season an indicator for the passer how much over or under expectation his completion percentage was.,numeric
290
+ series,"Starts at 1, each new first down increments, numbers shared across both teams NA: kickoffs, extra point/two point conversion attempts, non-plays, no posteam",numeric
291
+ series_success,"1: scored touchdown, gained enough yards for first down.",numeric
292
+ series_result,"Possible values: First down, Touchdown, Opp touchdown, Field goal, Missed field goal, Safety, Turnover, Punt, Turnover on downs, QB kneel, End of half",character
293
+ order_sequence,"Column provided by NFL to fix out-of-order plays. Available 2011 and beyond with source ""nfl"".",numeric
294
+ start_time,Kickoff time in eastern time zone.,character
295
+ time_of_day,"Time of day of play in UTC ""HH:MM:SS"" format. Available 2011 and beyond with source ""nfl"".",character
296
+ stadium,Game site name.,character
297
+ weather,"String describing the weather including temperature, humidity and wind (direction and speed). Doesn't change during the game!",character
298
+ nfl_api_id,UUID of the game in the new NFL API.,character
299
+ play_clock,Time on the playclock when the ball was snapped.,character
300
+ play_deleted,Binary indicator for deleted plays.,numeric
301
+ play_type_nfl,Play type as listed in the NFL source. Slightly different to the regular play_type variable.,character
302
+ special_teams_play,"Binary indicator for whether play is special teams play from NFL source. Available 2011 and beyond with source ""nfl"".",numeric
303
+ st_play_type,"Type of special teams play from NFL source. Available 2011 and beyond with source ""nfl"".",character
304
+ end_clock_time,Game time at the end of a given play.,character
305
+ end_yard_line,String indicating the yardline at the end of the given play consisting of team half and yard line number.,character
306
+ fixed_drive,Manually created drive number in a game.,numeric
307
+ fixed_drive_result,Manually created drive result.,character
308
+ drive_real_start_time,Local day time when the drive started (currently not used by the NFL and therefore mostly 'NA').,character
309
+ drive_play_count,Numeric value of how many regular plays happened in a given drive.,numeric
310
+ drive_time_of_possession,Time of possession in a given drive.,character
311
+ drive_first_downs,Number of first downs in a given drive.,numeric
312
+ drive_inside20,Binary indicator if the offense was able to get inside the opponents 20 yard line.,numeric
313
+ drive_ended_with_score,Binary indicator the drive ended with a score.,numeric
314
+ drive_quarter_start,Numeric value indicating in which quarter the given drive has started.,numeric
315
+ drive_quarter_end,Numeric value indicating in which quarter the given drive has ended.,numeric
316
+ drive_yards_penalized,Numeric value of how many yards the offense gained or lost through penalties in the given drive.,numeric
317
+ drive_start_transition,String indicating how the offense got the ball.,character
318
+ drive_end_transition,String indicating how the offense lost the ball.,character
319
+ drive_game_clock_start,Game time at the beginning of a given drive.,character
320
+ drive_game_clock_end,Game time at the end of a given drive.,character
321
+ drive_start_yard_line,String indicating where a given drive started consisting of team half and yard line number.,character
322
+ drive_end_yard_line,String indicating where a given drive ended consisting of team half and yard line number.,character
323
+ drive_play_id_started,Play_id of the first play in the given drive.,numeric
324
+ drive_play_id_ended,Play_id of the last play in the given drive.,numeric
325
+ away_score,Total points scored by the away team.,integer
326
+ home_score,Total points scored by the home team.,integer
327
+ location,Either 'Home' o 'Neutral' indicating if the home team played at home or at a neutral site.,character
328
+ result,Equals home_score - away_score and means the game outcome from the perspective of the home team.,integer
329
+ total,Equals home_score + away_score and means the total points scored in the given game.,integer
330
+ spread_line,"The closing spread line for the game. A positive number means the home team was favored by that many points, a negative number means the away team was favored by that many points. (Source: Pro-Football-Reference)",numeric
331
+ total_line,The closing total line for the game. (Source: Pro-Football-Reference),numeric
332
+ div_game,Binary indicator for if the given game was a division game.,integer
333
+ roof,"One of 'dome', 'outdoors', 'closed', 'open' indicating indicating the roof status of the stadium the game was played in. (Source: Pro-Football-Reference)",character
334
+ surface,What type of ground the game was played on. (Source: Pro-Football-Reference),character
335
+ temp,The temperature at the stadium only for 'roof' = 'outdoors' or 'open'.(Source: Pro-Football-Reference),integer
336
+ wind,The speed of the wind in miles/hour only for 'roof' = 'outdoors' or 'open'. (Source: Pro-Football-Reference),integer
337
+ home_coach,First and last name of the home team coach. (Source: Pro-Football-Reference),character
338
+ away_coach,First and last name of the away team coach. (Source: Pro-Football-Reference),character
339
+ stadium_id,ID of the stadium the game was played in. (Source: Pro-Football-Reference),character
340
+ game_stadium,Name of the stadium the game was played in. (Source: Pro-Football-Reference),character
341
+ success,Binary indicator wheter epa > 0 in the given play.,numeric
342
+ passer,Name of the dropback player (scrambles included) including plays with penalties.,character
343
+ passer_jersey_number,Jersey number of the passer.,integer
344
+ rusher,Name of the rusher (no scrambles) including plays with penalties.,character
345
+ rusher_jersey_number,Jersey number of the rusher.,integer
346
+ receiver,Name of the receiver including plays with penalties.,character
347
+ receiver_jersey_number,Jersey number of the receiver.,integer
348
+ pass,Binary indicator if the play was a pass play (sacks and scrambles included).,numeric
349
+ rush,Binary indicator if the play was a rushing play.,numeric
350
+ first_down,Binary indicator if the play ended in a first down.,numeric
351
+ aborted_play,"Binary indicator if the play description indicates ""Aborted"".",numeric
352
+ special,"Binary indicator if ""play_type"" is one of ""extra_point"", ""field_goal"", ""kickoff"", or ""punt"".",numeric
353
+ play,"Binary indicator: 1 if the play was a 'normal' play (including penalties), 0 otherwise.",numeric
354
+ passer_id,ID of the player in the 'passer' column.,character
355
+ rusher_id,ID of the player in the 'rusher' column.,character
356
+ receiver_id,ID of the player in the 'receiver' column.,character
357
+ name,"Name of the 'passer' if it is not 'NA', or name of the 'rusher' otherwise.",character
358
+ jersey_number,Jersey number of the player listed in the 'name' column.,integer
359
+ id,ID of the player in the 'name' column.,character
360
+ fantasy_player_name,Name of the rusher on rush plays or receiver on pass plays (from official stats).,character
361
+ fantasy_player_id,ID of the rusher on rush plays or receiver on pass plays (from official stats).,character
362
+ fantasy,Name of the rusher on rush plays or receiver on pass plays.,character
363
+ fantasy_id,ID of the rusher on rush plays or receiver on pass plays.,character
364
+ out_of_bounds,"1 if play description contains ran ob, pushed ob, or sacked ob; 0 otherwise.",numeric
365
+ home_opening_kickoff,"1 if the home team received the opening kickoff, 0 otherwise.",numeric
366
+ qb_epa,Gives QB credit for EPA for up to the point where a receiver lost a fumble after a completed catch and makes EPA work more like passing yards on plays with fumbles.,numeric
367
+ xyac_epa,"Expected value of EPA gained after the catch, starting from where the catch was made. Zero yards after the catch would be listed as zero EPA.",numeric
368
+ xyac_mean_yardage,Average expected yards after the catch based on where the ball was caught.,numeric
369
+ xyac_median_yardage,Median expected yards after the catch based on where the ball was caught.,integer
370
+ xyac_success,Probability play earns positive EPA (relative to where play started) based on where ball was caught.,numeric
371
+ xyac_fd,Probability play earns a first down based on where the ball was caught.,numeric
372
+ xpass,Probability of dropback scaled from 0 to 1.,numeric
373
+ pass_oe,Dropback percent over expected on a given play scaled from 0 to 100.,numeric