Skip to content

Commit

Permalink
Remove players without projections (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
amarvin authored Aug 30, 2024
1 parent a07ed9b commit cf82666
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ffbot/constants.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = "1.2.7"
VERSION = "1.2.8"
9 changes: 7 additions & 2 deletions ffbot/scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,10 @@ def get_projections(row):
df2 = pd.read_html(StringIO(html))[0]
for _, row2 in df2.iterrows():
week = "Week {}".format(row2["Week"])
points = row2["Fan Pts"]
if points[0] == "*":
points = row2.get("Fan Pts")
if points is None:
continue
elif points[0] == "*":
# Game hasn't occured yet
row[week] = float(points[1:])
# row[week + ' projection'] = float(points[1:])
Expand All @@ -150,6 +152,9 @@ def get_projections(row):
tqdm.pandas(desc="Scraping weekly forecasts")
df = df.progress_apply(get_projections, axis=1)

# Remove players without projections
df = df[~pd.isna(df["Week 1"])]

# Reorder columns
columns = list(df.columns)
columns[2], columns[1] = columns[1], columns[2]
Expand Down

0 comments on commit cf82666

Please sign in to comment.