vishaalagartha / basketball_reference_scraper

A python module for scraping static and dynamic content from Basketball Reference.
MIT License
254 stars 91 forks source link

Missing data #22

Closed KingKO04 closed 4 years ago

KingKO04 commented 4 years ago

I would attempt to get stats from a team's roster and columns would be missing and replaced by a column of "..." (no matter how many columns were missing, it would be replaced by a singular column). image

vishaalagartha commented 4 years ago

This is expected behavior. The return type of get_stats is a pandas dataframe, which does not show the entire result if the number of rows/columns is too large. Your return value says [19 rows x 30 columns], so the data is clearly returned.

In order to see the entire dataframe, refer to this link.

vishaalagartha commented 4 years ago

Try this code snippet out:

import pandas as pd
from basketball_reference_scraper.teams import get_roster_stats
pd.set_option("display.max_rows", None, "display.max_columns", None)
df = get_roster_stats('DAL', 2020, data_format='TOTALS', playoffs=False)
print('==========Entire dataframe=======')
print(df)

# To print a specific column, like 2P%
print(df['2P%'])

You may be more comfortable with python lists, so you could always convert a column like l = list(df['2P%']), but I would encourage you to learn to use pandas since it is so prevalent in data analysis.