Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NBA Boxscores not pulling with date #719

Open
John8640 opened this issue Mar 24, 2022 · 0 comments
Open

NBA Boxscores not pulling with date #719

John8640 opened this issue Mar 24, 2022 · 0 comments

Comments

@John8640
Copy link

Lately I'm trying to pull NBA boxscore data with sportsipy for a list of dates in date_df with the following code:

def game_data_up_to_date(date_df):
    games_df1 = pd.DataFrame()
    for d in range(len(date_df)):
        date_string = date_df.iloc[d]['date']
        day_scores = Boxscores(pd.to_datetime(date_df.iloc[d]['date']))
        games_df = pd.DataFrame()
        for g in range(len(day_scores.games[date_string])):
            game_str = day_scores.games[date_string][g]['boxscore']
            game_stats = Boxscore(game_str)
            game_df = pd.DataFrame(day_scores.games[date_string][g], index = [0])

        games_df1 = pd.concat([games_df1,games_df]).reset_index().drop(columns = 'index') 
   
    return games_df1

The expected output is the boxscore for each date and game in the list

I think the issue is is when I call day_scores = Boxscores(pd.to_datetime(date_df.iloc[d]['date']))
Boxscores does not seem to be pulling the correct information which is causing the rest of the code to malfunction.

I am also uncertain if lines
game_str = day_scores.games[date_string][g]['boxscore']
game_stats = Boxscore(game_str)
are working since the previous line to get day_scores is not.

I have used sportsipy before and never had this issue. I recently updated to Spyder 5.1.5 on my Mac (OS Monterey 12.1) and I have the latest version of sportsipy installed. I'm not sure if this is simply a user error on my end or something with the package itself. This is my first post on Github, and I'm not really sure if I've provided the correct information or context. If there is anymore info I can provide, I'm more than happy :)

@John8640 John8640 changed the title NBA Boxscores not working NBA Boxscores not pulling with date Mar 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant