def stats():
import pandas as pd
# Load the CSV file into a Pandas DataFrame
df = pd.read_csv('nba_player_stats.csv')
print(df)
def display_player(team):
import pandas as pd
# Load the CSV file into a Pandas DataFrame
df = pd.read_csv('nba_player_stats.csv')
# Filter the DataFrame based on the team
team_df = df[df['TEAM'] == team]
if not team_df.empty:
# Display the players on the specified team
print(team_df)
else:
print("No players found for the specified team.")
# Example usage
display_player('Pho')
import pandas as pd
# Load the CSV file into a Pandas DataFrame
df = pd.read_csv('nba_player_stats.csv')
# Filter the DataFrame to only include stats for a specific player (in this case, Jimmy Butler)
player_name = 'Jimmy Butler'
player_stats = df[df['NAME'] == player_name]
# Display the stats for the player
print(f"\nStats for {player_name}:")
print(player_stats[['PPG', 'RPG', 'APG', 'AGE']])
import pandas as pd
# Load the CSV file into a Pandas DataFrame
df = pd.read_csv('nba_player_stats.csv')
# Get the player name from the user
player_name = input("Enter the player's name: ")
# Filter the DataFrame to only include stats for the specified player
player_stats = df[df['NAME'] == player_name]
# Check if the player exists in the DataFrame
if player_stats.empty:
print("Player not found.")
else:
# Display the stats for the player
print(f"\nStats for {player_name}:")
print(player_stats[['PPG', 'RPG', 'APG', 'AGE']])
def points():
import pandas as pd
# Load the CSV file into a Pandas DataFrame
df = pd.read_csv('nba_player_stats.csv')
# Prompt the user to input a player name and points scored
player_name = input("Enter the player's name: ")
points_line = int(input("Enter the players points line: "))
# Filter the DataFrame to only include rows for the input player name
player_stats = df[df['NAME'] == player_name]
# If the input player name is not found, print an error message and exit
if player_stats.empty:
print("Error: Player not found")
exit()
# Calculate the player's average points per game
avg_ppg = player_stats['PPG'].mean()
if points_line > avg_ppg:
print(points_line , ">" , avg_ppg)
else:
print(points_line, "<" , avg_ppg)
# Compare the input points scored to the player's average points per game
if points_line > avg_ppg:
print("This is a good under bet")
elif points_line == avg_ppg:
print("This bet is 50/50")
else:
print("This is a good over bet")
points()
def rebounds():
import pandas as pd
# Load the CSV file into a Pandas DataFrame
df = pd.read_csv('nba_player_stats.csv')
# Prompt the user to input a player name and points scored
player_name = input("Enter the player's name: ")
rebound_line = int(input("Enter the players rebound line: "))
# Filter the DataFrame to only include rows for the input player name
player_stats = df[df['NAME'] == player_name]
# If the input player name is not found, print an error message and exit
if player_stats.empty:
print("Error: Player not found")
exit()
# Calculate the player's average points per game
avg_RPG = player_stats['RPG'].mean()
if rebound_line > avg_RPG:
print(rebound_line , ">" , avg_RPG)
else:
print(rebound_line, "<" , avg_RPG)
# Compare the input points scored to the player's average points per game
if rebound_line > avg_RPG:
print("This is a good under bet")
elif rebound_line == avg_RPG:
print("This bet is 50/50")
else:
print("This is a good over bet")
rebounds()
def assists():
import pandas as pd
# Load the CSV file into a Pandas DataFrame
df = pd.read_csv('nba_player_stats.csv')
# Prompt the user to input a player name and points scored
player_name = input("Enter the player's name: ")
assist_line = int(input("Enter the players assist line: "))
# Filter the DataFrame to only include rows for the input player name
player_stats = df[df['NAME'] == player_name]
# If the input player name is not found, print an error message and exit
if player_stats.empty:
print("Error: Player not found")
exit()
# Calculate the player's average points per game
avg_APG = player_stats['APG'].mean()
if assist_line > avg_APG:
print(assist_line , ">" , avg_APG)
else:
print(assist_line, "<" , avg_APG)
# Compare the input points scored to the player's average points per game
if assist_line > avg_APG:
print("This is a good under bet")
elif assist_line == avg_APG:
print("This bet is 50/50")
else:
print("This is a good over bet")
assists()
def process():
stats = input("stats, points, rebounds, and assists")
if stats == "stats":
import pandas as pd
# Load the CSV file into a Pandas DataFrame
df = pd.read_csv('nba_player_stats.csv')
print(df)
elif stats == "points":
def points():
import pandas as pd
# Load the CSV file into a Pandas DataFrame
df = pd.read_csv('nba_player_stats.csv')
# Prompt the user to input a player name and points scored
player_name = input("Enter the player's name: ")
points_line = int(input("Enter the players points line: "))
# Filter the DataFrame to only include rows for the input player name
player_stats = df[df['NAME'] == player_name]
# If the input player name is not found, print an error message and exit
if player_stats.empty:
print("Error: Player not found")
exit()
# Calculate the player's average points per game
avg_ppg = player_stats['PPG'].mean()
if points_line > avg_ppg:
print(points_line , ">" , avg_ppg)
else:
print(points_line, "<" , avg_ppg)
# Compare the input points scored to the player's average points per game
if points_line > avg_ppg:
print("This is a good under bet")
elif points_line == avg_ppg:
print("This bet is 50/50")
else:
print("This is a good over bet")
points()
elif stats == "rebounds":
def rebounds():
import pandas as pd
# Load the CSV file into a Pandas DataFrame
df = pd.read_csv('nba_player_stats.csv')
# Prompt the user to input a player name and points scored
player_name = input("Enter the player's name: ")
rebound_line = int(input("Enter the players rebound line: "))
# Filter the DataFrame to only include rows for the input player name
player_stats = df[df['NAME'] == player_name]
# If the input player name is not found, print an error message and exit
if player_stats.empty:
print("Error: Player not found")
exit()
# Calculate the player's average points per game
avg_RPG = player_stats['RPG'].mean()
if rebound_line > avg_RPG:
print(rebound_line , ">" , avg_RPG)
else:
print(rebound_line, "<" , avg_RPG)
# Compare the input points scored to the player's average points per game
if rebound_line > avg_RPG:
print("This is a good under bet")
elif rebound_line == avg_RPG:
print("This bet is 50/50")
else:
print("This is a good over bet")
rebounds()
elif stats == "assists":
def assists():
import pandas as pd
# Load the CSV file into a Pandas DataFrame
df = pd.read_csv('nba_player_stats.csv')
# Prompt the user to input a player name and points scored
player_name = input("Enter the player's name: ")
assist_line = int(input("Enter the players assist line: "))
# Filter the DataFrame to only include rows for the input player name
player_stats = df[df['NAME'] == player_name]
# If the input player name is not found, print an error message and exit
if player_stats.empty:
print("Error: Player not found")
exit()
# Calculate the player's average points per game
avg_APG = player_stats['APG'].mean()
if assist_line > avg_APG:
print(assist_line , ">" , avg_APG)
else:
print(assist_line, "<" , avg_APG)
# Compare the input points scored to the player's average points per game
if assist_line > avg_APG:
print("This is a good under bet")
elif assist_line == avg_APG:
print("This bet is 50/50")
else:
print("This is a good over bet")
assists()
else:
print("Invalid option")
process()
import requests
url = "http://127.0.0.1:8067/playerList"
payload = "<file contents here>"
headers = {
'Content-Type': 'text/plain'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)