In this assignment, we will use the K-nearest neighbors algorithm to predict how many points NBA players scored in the 2013-2014 season.
https://www.dropbox.com/s/b3nv38jjo5dxcl6/nba_2013.csv?dl=0
Before we dive into the algorithm, let’s take a look at our data. Each row in the data contains information on how a player performed in the 2013-2014 NBA season. Here are some selected columns from the data:
player - name of the player
pos - the position of the player
g - number of games the player was in
gs - number of games the player started
pts - total points the player scored
There are many more columns in the data, mostly containing information about average player game performance over the course of the season. We can read our dataset in and figure out which columns are present:
import pandas
with open("nba_2013.csv", 'r') as csvfile:
nba = pandas.read_csv(csvfile)