''' DS2500 Spring 2025 Sample code from lecture - create HockeyTeam objs from a file ''' import matplotlib.pyplot as plt from hockeyteam import HockeyTeam from utils import * FILENAME = "pwhl_small.csv" def plot_teams(teams): ''' make a scatterplot for wins/losses of all the teams ''' wins = [team.wins for team in teams] losses = [team.losses for team in teams] plt.scatter(wins, losses, color = "magenta") plt.title("PWHL 2023-2024 Season: Wins vs Losses") plt.xlabel("Number of Wins") plt.ylabel("Number of Losses") plt.show() def main(): # gather data: read in the CSV file full of hockey data # example one - calling read_csv without providing skip = # skips the header lst = read_csv(FILENAME) print(lst) # example two - calling read_csv with skip = 0 # keeps the header lst2 = read_csv(FILENAME, skip = 0) print(lst2, "\n") # Use lst (no header) to create HockeyTeam objects teams = [] for row in lst: team = HockeyTeam(row[0], row[2], row[3]) print(team) teams.append(team) # comm: plot the teams' wins and losses plot_teams(teams) if __name__ == "__main__": main()