<jupyter_start><jupyter_text>Analysis--- Research Question 1: *Are college sports more unbalanced than professional sports? Do more dynasties exist throughout history in college sports compared to professional sports?* Research Question 2: *What are the most dominant sports dynasties throughout history?* Research Question 3: *What team(s) are the New York Giants biggest weaknesses?* To answer questions 1 and 2, we can start by recalling the count plot we discovered in out EDA, that gave us the most winning sports franchises throughout history, but expand the plot to include 20 teams:<jupyter_code>import pandas as pd
import numpy as np
import matplotlib as plt
import seaborn as sns
from scripts import project_functions as pf

df = pf.load_and_process('../data/raw/dataset.csv')

pf.placements(df,'First Place',20)<jupyter_output><empty_output><jupyter_text>This gives us the teams with the most first place finishes, but to find out which dynasties were most dominant during a certain time, we may want to see which of these 20 teams have impressive win streaks, instead of just a bunch of 1 win streaks spread throughout the team's existence.<jupyter_code>pf.placements_and_streaks(df,'First Place',20)<jupyter_output><empty_output><jupyter_text>Just in case, plot the sport of the top 20 most winning teams, so we know what sport we are talking about in particular:<jupyter_code>pf.topteam_sport(df)<jupyter_output><empty_output><jupyter_text>We can analyze the amount of First Place finishes, along with the teams with higher win streaks, to get a generally good idea of who the most dominant dynasties may be. I found that the top 10 best teams, based on the plot above, seemed to be the following:- North Carolina Tar Heels (Womens College Soccer)- New York Yankees (MLB)- Montreal Canadiens (NHL)- USC Trojans (Mens College Baseball)- UCLA Bruins (Mens College Basketball)- Yale Bulldogs (Mens College Football)- Boston Celtics (NBA)- Connecticut Huskies (Womens College Basketball)- Edmonton Eskimos (CFL)- Green Bay Packers (NFL) *(I went off of highest win streaks first, then most wins, because I believe a power team is truly shown by how many in a row they win.)*With the following data, we can confidently answer **Research Question 1** and say that college sports do not seem anymore unbalanced than pro sports have been in the past. Our top 10 teams consist of 5 college teams and 5 professional teams, and even looking at the 20 most winning sports franchises we can see that it seems to be a pretty even split. This means that despite college sports seeming more unfair since star players can all choose to commit to the same school, they still seem to be as balanced as pro leagues, with similar amount of sports dynasties.Continuing on with our analysis, we now have a pretty good idea of the most dominant teams through history, but it does not tell us the specific group of players and year where the above orginizations may have dominated the most. So, we now plot each of these 10 teams, and the win streaks they had every time they won:<jupyter_code>pf.winstreak_history(df,'North Carolina Tar Heels','Soccer (W)')
pf.winstreak_history(df,'New York Yankees','MLB')
pf.winstreak_history(df,'Montreal Canadiens','NHL')
pf.winstreak_history(df,'USC Trojans','Baseball (M)')
pf.winstreak_history(df,'UCLA Bruins','Basketball (M)')
pf.winstreak_history(df,'Yale Bulldogs','Football (M)')
pf.winstreak_history(df,'Boston Celtics','NBA')
pf.winstreak_history(df,'Connecticut Huskies','Basketball (W)')
pf.winstreak_history(df,'Edmonton Eskimos','CFL')
pf.winstreak_history(df,'Green Bay Packers','NFL')<jupyter_output><empty_output><jupyter_text>Since each bar on the plot equals 1 year where they won, and touching bars (the wider-looking bars) means they won consecutive years, we can answer our **Research Question 2**  and determine the specific top 10 sports dynasties based on these plots:- 1982-2012 <NAME> (Womens College Soccer)- 1936-1963 Yankees (MLB)- 1953-1980 Canadiens (NHL)- 1968-1979 Trojans (Mens College Baseball)- 1964-1976 Bruins (Mens College Basketball)- 1875-1896 Bulldogs (Mens College Football)- 1957-1970 Celtics (NBA)- 1995-2016 Huskies (Womens College Basketball)- 1975-1983 Eskimos (CFL)- 1961-1968 Packers (NFL)*(As a rule, I decided a gap of more than 5 years between wins meant the end of a dynasty.)*It was also nice to see that all the top 10 teams came from a different sports league, showing how each league has had their share of power teams.---Now, to answer our 3rd question, lets first show the plot of the teams with the most second place finishes, as shown in our EDA:<jupyter_code>pf.placements(df,'Second Place',20)<jupyter_output><empty_output><jupyter_text>As we can see, The New York Giants in particular have come second place a lot, almost 10 more times than the team with the second most runner-ups, the Stanford Cardinals. Now, to see who has stopped The Giants from coming so close the most, we must count each team that is first place when the second place team is the New York Giants:<jupyter_code>df.team_weakness(df,'New York Giants')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.06936079269477366, 'fraction_numerical': 0.02312026423159122, 'mean_word_length': 5.557961783439491, 'pattern_counts': {'":': 0, '<': 26, '<?xml version=': 0, '>': 26, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '225067', 'license': 'MIT', 'n_tokens_mistral': 1541, 'n_tokens_neox': 1383, 'n_words': 711, 'path': 'analysis/.ipynb_checkpoints/analysis-checkpoint.ipynb', 'repo_name': 'data301-2020-winter2/course-project-solo_104', 'size': '5150'}