top of page


Public·10 membres

Nba Player Data Csv

This package is designated for all NBA enthusiasts! The rsketball package works to scrape online tabular data from the ESPN NBA website into a csv file. It also includes various functions to create graphs and statistical analysis for your interest (such as boxplots, player rankings by stats, and a summary statistics table).

nba player data csv

Download Zip:

The following steps are required only for the nba_scraper function. If you already have the scraped data file and wish to use the other functions (nba_boxplot, nba_rank, nbastats), there is no need to proceed with these steps.

nba_scraper() will help you create the dataframe of the NBA season of interest to conduct further analysis using the functions below. The following examples is for scraping the playoffs (postseason) season in 2017/18 while saving to a local csv file.

Effective usage of the rest of the functions in rsketball may require certain knowledge of the available columns in the scraped data. For more context on the column names of the scraped data set, please refer to the dataset description file. This will help the user better understand what columns are included in the scraped data, as well as what they represent.

This rsketball package aims to further gain understanding of ESPN NBA data and does not have a specific fit to the R ecosystem. There are currently some other library packages such as nbastatR that take data from other sources (NBA Stats API, Basketball Insiders, Basketball-Reference, HoopsHype, and RealGM), but no package that we currently know of takes data from ESPN NBA specifically.

The player_data file contains a record for each player that recorded any statistics during a game. The event data table contains a record for each game, identified by a unique gameID. This gameID can be used to join the two data sources.

Next, a function is created to calculate rolling averages for any statistic. The function takes in a data frame, a target field for the rolling averages, and a window variable in the form seq(starting_window,max_window,increment).

Using the new team_data table, team based features can be calculated. The total FD points for each team and their opponent are calculated below. These features are then merged back to the player_data table.

The code below aggregates the FD points by game,team and position. These results are then joined back to team_data, and computed for the opponents. Rolling averages are then calculated, and finally merged back to player_data.

For the NBA, the FD points distribution is positvely skewed. There is a large number of occurences where players score 0 FD points, despite having played more than 0 minutes in the game. This is due to players recording no statisitcs during their time on the court. The mean and median FD points for all players is 18.8 & 17.1, respectively.

In general, there an approximately even number of players across all positions, with centers having slightly fewer numbers. On average, 1.7 centers play per game per team, compared to 2.0-2.3 players at the other positions.

An additional feature is created to predict minutes played. Playing time can be impacted by injuries, fouls, blowout games or games that go to overtime. In order to predict such instances, more advanced models would be required. A simple way to account for a potential increase or decrease in playing time is to measure the depth (i.e. number of players at each position).

There appears to be a significant trend between positional depth and minutes played. As expected, greater positional depth leads to less playing time. There appears to be some outliers at pos_depth>5, as it is highly unlikely that a team would carry more than 5 players at a single position.

Point guards and centers tend to record the most FD points on a nightly basis. For the Fanduel site, lineups must have a fixed number of players at each position. However, other DFS sites allow for flex positions, so targeting point guards & centers in those spots could be an advantageous strategy.

The cell with -0.38 represents the correlation between the total point guard fantasy points and total shooting guard fantasy points. In general, players on the same team are negatively correlated with each other. Intuitively this makes sense, as the stolen shot attempts from one player outweigh the fantasy points generated by assists. The negative correlation is less significant between perimiter & post players (i.e. PG/C or SG/C).

As expected, high scoring games correlate directly with higher fantasy point production. Oddsmaker publish projection point totals for each NBA game, so players playing in high projected point games should be targeted.

The first final plot chosen was created using one of the engineered feature variables. The variable created was the amount of fantasy points allowed by each team to each opposing position for every game. The plot below shows the average fantasy points allowed to each position over all seasons present in the data set.

In general, players on the same team are negatively correlated with each other. The negative correlation is less significant between perimiter & post players (i.e. PG/C or SG/C). The correlation between opposing players at each position is less significant. As a result, choosing players on opposite teams should not have a negative impact on fantasy production, unlike other matchup based fantasy spots where opposing players are more negatively correlated (i.e. hockey goalies & opposing skaters, baseball pitchers and opposing batters).

Overall, using R for the exploratory data analysis was a good experience as the language and development environment in R studio make work quick and easy. Once I learned the syntax of data.table and ggplot, and the useful library reshape, data cleaning, massaging and aggregating became extremely quick and efficient. Being able to quickly group, select and aggregate to produce stats along with plots made the analysis more thorough and informative. Most difficulties encountered were related to formatting with ggplot2 (i.e. changing label title, creating facet grids, custom x-axis labels etc.). Despite these minor difficulties, I find plotting with R & RStudio a much better experience than Python.

For future work, it is recommended to add in other data sources to explore additional variables that may impact fantasy points. For example, vegas odds variables such as win probability or total projected points could be useful. The analysis showed that games that go to overtime or are high scoring yield higher average fantasy point totals, so games with narrow win margins or high projected point totals could be targeted.

Welcome to the NBA Height/Weight Dataset. This project began as a simply Python script to scrape Height and Weight of player from Basketball-Reference. Right now, outputs in the format of a CSV file as follows:

I spent an hour flipping through Python for Data Analysis to see if anything caught my eye given I've spent some type with IPython notebooks, numpy and a little pandas, and in fact it became clear there's a way easier way to do some of the exploratory scatterplots that I was doing by hand yesterday. Here's another notebook using a pandas data frame to load in the same nba player data set and quickly exploring two variable relationships using a scatter matrix.

I was avoiding using pandas for csv munging because it seemed like overkill, but I'm coming to appreciate its use even for a single csv; exploring a table of data is one of the things pandas is really built for.

In the only tech-heavy step of this project, we wrote a function in Google Apps Script to parse the NBA Player List from, then populate a Google Sheet with each player's name, team, number, position, school, nationality, height, birthday, age and headshot URL.

Of course, each NBA player is on an NBA team, and each team contains players. That's a prime use case for relational databases. By connecting players with teams via reciprocal Relation properties, we ensure clean, consistent data. It also allows us to use Rollup properties for interesting summaries, such as the total number of players on each team, or each roster's oldest and youngest players.

In Notion, each item in a database is a page, and Notion pages have icons. For the NBA Teams database, we made each team's logo its icon. This displays the logo next to the team name when it appears in databases (including Relation properties, as we see in our player galleries), when linked within pages, and in the sidebar.

To explore player profiles, we preconfigured a variety of Views in the Gallery format. Each is Sorted by the Last Name property and Filtered by Team or School. After creating one, we could simply duplicate it, rename it, and change the Filter.

Opening a team page below a conference displays its roster. That roster is a Linked Database connected to the 2020 NBA Players database. It's formatted as a Gallery, Sorted by the Last Name property and Filtered for the respective team.

As an example, I will be scraping data from the rosters of each team in the NBA for information such as player age, height, weight, and salary. I will also loop through each individual player's stats page and extract career averages such as points per game, free throw percentages, and more (as of currently, March 2020).

I've exported the data to a nicely organized csv file, accessible in the GitHub repo for this project, in case you would like to analyze it yourself. You can also run the python script to re-scrape ESPN for up-to-date data.

In the following sections, I will describe how to loop through ESPN page sources using urllib, extract information using re (regular expressions), organize player statistics in pandas DataFrames, and perform some simple modeling using scikit-learn.

In my last post I produced some NBA shot charts in R using data scraped from and ggplot2. This time I extracted all shot location data available for 490 players and linked it to a Tableau dashboard. 041b061a72

  • À propos

    Bienvenue dans le groupe ! Vous pouvez communiquer avec d'au...

    Page de groupe: Groups_SingleGroup
    bottom of page