You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Discussions aren't enabled for this project, so apologies if this is not the right forum to ask for assistance.
I am trying to generate the weekly stats, but unable to. It complains about 'records_df' but I'm unsure what to do with this. I tried to reverse engineer a bit of the python coding but wasn't able to figure this out. Any guidance here for how to generate this? I'm able to get the library to do other things and pull other stats, but just not these weekly/season stats.
Python 3.12.7 (main, Oct 1 2024, 08:52:12) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from src.doritostats.fetch_utils import fetch_league
>>> league_id = 2004529243
>>> year = 2024
>>> league = fetch_league(league_id, year)
[BUILDING LEAGUE] Fetching league data...
[BUILDING LEAGUE] League endpoint set to: https://lm-api-reads.fantasy.espn.com/apis/v3/games/ffl/seasons/2024/segments/0/leagues/2004529243?
[BUILDING LEAGUE] Gathering roster settings information...
[BUILDING LEAGUE] Loading current league details...
>>> from src.doritostats.analytic_utils import weekly_stats_analysis
>>> weekly_stats_analysis(records_df, year=2024, week=3)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'records_df' is not defined
>>>
The text was updated successfully, but these errors were encountered:
@bdf0506 Sorry for not responding sooner. This error is because the weekly_stats_analysis() function expects a dataframe (records_df) that contains all the scraped matchup data. That can be pulled using the following code:
fromsrc.doritostats.filter_utilsimportexclude_most_recent_weekfromsrc.doritostats.scrape_team_statsimportscrape_team_statsmin_year=2019# Or whatever the oldest year in your league wasmax_year=2024records_df=scrape_team_stats(league_id, min_year, max_year, swid, espn_s2)
records_df=exclude_most_recent_week(records_df) # To remove the current week (since it's data is incomplete)weekly_stats_analysis(records_df, year=2024, week=3)
Discussions aren't enabled for this project, so apologies if this is not the right forum to ask for assistance.
I am trying to generate the weekly stats, but unable to. It complains about 'records_df' but I'm unsure what to do with this. I tried to reverse engineer a bit of the python coding but wasn't able to figure this out. Any guidance here for how to generate this? I'm able to get the library to do other things and pull other stats, but just not these weekly/season stats.
The text was updated successfully, but these errors were encountered: