Skip to content

Commit

Permalink
flag for bugged pass yardage to flag in UI
Browse files Browse the repository at this point in the history
  • Loading branch information
akeaswaran committed Sep 1, 2024
1 parent 6ab746d commit ff7a52c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
# Versions should comply with PEP440. For a discussion on single-sourcing
# the version across setup.py and the project code, see
# https://packaging.python.org/en/latest/single_source_version.html
version="0.0.36.2.15",
version="0.0.36.2.16",
description="Retrieve Sports data in Python",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down
5 changes: 5 additions & 0 deletions sportsdataverse/cfb/cfb_pbp.py
Original file line number Diff line number Diff line change
Expand Up @@ -1636,16 +1636,20 @@ def __add_rush_pass_flags(self, play_df):
False,
)
# bugged games - 2024 WK1
play_df['bugged_stat_yardage'] = (play_df["pass"] == True) & (play_df.text.str.contains(" complete to ", case=False)) & (play_df['statYardage'] == 0) & ((play_df['start.yardsToEndzone'] != play_df['end.yardsToEndzone']) | (play_df['start.yardsToEndzone'] != (100 - play_df['end.yardsToEndzone'])))

play_df['statYardage'] = np.select(
[
(play_df["pass"] == True)
& (play_df.text.str.contains(" complete to ", case=False))
& (play_df['statYardage'] == 0)
& (play_df['start.yardsToEndzone'] != play_df['end.yardsToEndzone'])
& (play_df['start.team.id'] != play_df['end.team.id']),

(play_df["pass"] == True)
& (play_df.text.str.contains(" complete to ", case=False))
& (play_df['statYardage'] == 0)
& (play_df['start.yardsToEndzone'] != play_df['end.yardsToEndzone'])
],
[
play_df['start.yardsToEndzone'] - (100 - play_df['end.yardsToEndzone']),
Expand Down Expand Up @@ -5161,6 +5165,7 @@ def create_box_score(self):
rush_box = self.plays_json[(self.plays_json["rush"] == True) & (self.plays_json.scrimmage_play == True)]
# pass_box.yds_receiving.fillna(0.0, inplace=True)
passer_box = pass_box[(pass_box["pass"] == True) & (pass_box["scrimmage_play"] == True)].fillna(0.0).groupby(by=["pos_team","passer_player_name"], as_index=False, group_keys = False).agg(
bugged_stat_yardage = ('bugged_stat_yardage', mean),
Comp = ('completion', sum),
Att = ('pass_attempt',sum),
Yds = ('yds_passing', sum),
Expand Down

0 comments on commit ff7a52c

Please sign in to comment.