# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

import pandas as pd
import numpy as np
import statsmodels.api as sm
import statsmodels.formula.api as smf
from sklearn import linear_model as lm
import collections
# %matplotlib inline

data1 = pd.read_csv('round_regression_data.csv', index_col=["Player ID"])
df = pd.DataFrame(data1)
print(df.shape)
df.head()


y = df['Round'].values
x1 = df['Games'].values
x2 = df['Total Rebounds'].values
x3 = df['Free Throw Percentage'].values
x4 = df['Points Per Game'].values
x5 = df['Total Rebounds Per Game'].values

y = df['Round'].values
X = df[['Games', 'Total Rebounds', 'Free Throw Percentage', 'Points Per Game', 'Total Rebounds Per Game']].values
X = sm.add_constant(X)
model = sm.OLS(y, X).fit()
model.summary()

y = df['Round'].values
X = df[['Games', 'Total Rebounds', 'Free Throw Percentage', 'Points Per Game', 'Total Rebounds Per Game']].values
model = lm.LinearRegression()
reg = model.fit(X,y)
reg.intercept_


b0 = reg.intercept_
b1 = reg.coef_[0]
b2 = reg.coef_[1]
b3 = reg.coef_[2]
b4 = reg.coef_[3]
b5 = reg.coef_[4]

print('y = %.4f(%.1f) + %.4f(%.1f) + %.4f(%.3f) + %.4f(%.1f) + %.4f(.1%f) + %.2f' % (b1,x1,b2,x2,b3,x3,b4,x4,b5,x5,b0))

# +
x1 = float(input('Enter Number of Games: '))
x2 = float(input('Enter Total Rebounds Per Season: '))
x3 = float(input('Enter Free Throw Percentage: '))
x4 = float(input('Enter Points Per Game Average: '))
x5 = float(input('Enter Total Rebounds Per Game Average: '))

y = (b1*x1) + (b2*x2) + (b3*x3) + (b4*x4) + (b5*x5) + b0
y = round(y)

print("")

if y==1:
    print('Player will likely be drafted in the first round.')
elif y==2:
    print('Player will most likely be drafted in the second round.')
else:
    print('Unlikely player will be drafted into the NBA.')


# -

data2 = pd.read_csv('overall_pick_data.csv', index_col=["Player ID"])
data2



StarcoderdataJupyterScriptsDedupFiltered