__STYLES__
This project was a passion project created out of my love for basketball and the NBA. My goal was to answer two questions:
Doing all of this involved web scraping, using the NBA_API, Docker to setup a Postgres SQL database, and Power BI to create the visuals.
All of the code for this project can be found at my Github: NBA Payroll Project
I wanted to put all of the data into a SQL database so that Power BI could easily connect to it. This is where Docker came in, so to start the project, I created my docker-compose.yml file.
Now that the docker compose file is created, its time to get the data. There are two datasets we need. First, we need yearly payroll data for each team. Second, we need year by year statistics. This will include standings and finals appearances.
I couldn't find an API that had yearly payroll data, so I had to scrape it. This ended up being fairly easy. I found the data at Hoops Hype. I simply used the BeautifulSoup library to scrape the data from the site.
Once I had scraped the data, I used pandas .tosql and SQLalchemy to upload the database to the PostgresSQL database I created earlier.
For this dataset, I was able to use the NBA_API teamyearbyyearstats endpoint. This made it very simple to pull the data. Again I uploaded it to the SQL database and moved on to creating the visuals.
To create the visuals, I simply connected Power BI to the locally hosted SQL database, and then used Power Query to merge the payroll data, onto the year by year data. This let me begin creating the visuals you see in the featured screenshot.