<jupyter_start><jupyter_text>IntroductionThis assignment will test how well you're able to perform various data science-related tasks.Each Problem Group below will center around a particular dataset that you have worked with before.To ensure you receive full credit for a question, make sure you demonstrate the appropriate pandas, altair, or other commands as requested in the provided code blocks. You may find that some questions require multiple steps to fully answer. Others require some mental arithmetic in addition to pandas commands. Use your best judgment. SubmissionEach problem group asks a series of questions. This assignment consists of two submissions:1. After completing the questions below, open the Module 01 Assessment Quiz in Canvas and enter your answers to these questions there.2. After completing and submitting the quiz, save this Colab notebook as a GitHub Gist (You'll need to create a GitHub account for this), by selecting `Save a copy as a GitHub Gist` from the `File` menu above.    In Canvas, open the Module 01 Assessment GitHub Gist assignment and paste the GitHub Gist URL for this notebook. Then submit that assignment.  Problem Group 1For the questions in this group, you'll work with the Netflix Movies Dataset found at this url: [https://raw.githubusercontent.com/byui-cse/cse450-course/master/data/netflix_titles.csv](https://raw.githubusercontent.com/byui-cse/cse450-course/master/data/netflix_titles.csv)  Question 1Load the dataset into a Pandas data frame and determine what data type is used to store the `release_year` feature.<jupyter_code>import pandas as pd 
netflix = pd.read_csv("https://raw.githubusercontent.com/byui-cse/cse450-course/master/data/netflix_titles.csv")
# netflix.info()
netflix.head(20)
# netflix.head(20)
netflix.info()<jupyter_output><class 'pandas.core.frame.DataFrame'>
RangeIndex: 6234 entries, 0 to 6233
Data columns (total 12 columns):
 #   Column        Non-Null Count  Dtype 
---  ------        --------------  ----- 
 0   show_id       6234 non-null   int64 
 1   type          6234 non-null   object
 2   title         6234 non-null   object
 3   director      4265 non-null   object
 4   cast          5664 non-null   object
 5   country       5758 non-null   object
 6   date_added    6223 non-null   object
 7   release_year  6234 non-null   int64 
 8   rating        6224 non-null   object
 9   duration      6234 non-null   object
 10  listed_in     6234 non-null   object
 11  description   6234 non-null   object
dtypes: int64(2), object(10)
memory usage: 584.6+ KB<jupyter_text>Question 2Filter your dataset so it contains only `TV Shows`. How many of those TV Shows were rated `TV-Y7`?<jupyter_code>tv_shows = netflix.query("type=='TV Show'")
tv_shows.head(20)

tv_shows['rating'].where(tv_shows['rating'] == "TV-Y7").value_counts()<jupyter_output><empty_output><jupyter_text>Question 3Further filter your dataset so it only contains TV Shows released between the years 2000 and 2009 inclusive. How many of *those* shows were rated `TV-Y7`?<jupyter_code>target_years = ['2000','2001','2002','2003','2004','2005','2006','2007','2008','2009']
years = tv_shows[tv_shows['release_year'].isin(target_years)]
years['rating'].where(years['rating']=="TV-Y7").value_counts()<jupyter_output><empty_output><jupyter_text>Problem Group 2For the questions in this group, you'll work with the Cereal Dataset found at this url: [https://raw.githubusercontent.com/byui-cse/cse450-course/master/data/cereal.csv](https://raw.githubusercontent.com/byui-cse/cse450-course/master/data/cereal.csv)  Question 4After importing the dataset into a pandas data frame, determine the median amount of `protein` in cereal brands manufactured by Kelloggs. (`mfr` code "K")<jupyter_code>cereals = pd.read_csv("https://raw.githubusercontent.com/byui-cse/cse450-course/master/data/cereal.csv")
cereals.info()

cereals.head(20)
kellogs = cereals.query("mfr =='K'")
print(kellogs)
print('kellogs median protein:',kellogs['protein'].median())<jupyter_output>name mfr type  ...  weight  cups     rating
2                      All-Bran   K    C  ...    1.00  0.33  59.425505
3     All-Bran with Extra Fiber   K    C  ...    1.00  0.50  93.704912
6                   Apple Jacks   K    C  ...    1.00  1.00  33.174094
16                  Corn Flakes   K    C  ...    1.00  1.00  45.863324
17                    Corn Pops   K    C  ...    1.00  1.00  35.782791
19           Cracklin' Oat Bran   K    C  ...    1.00  0.50  40.448772
21                      Crispix   K    C  ...    1.00  1.00  46.895644
24                  Froot Loops   K    C  ...    1.00  1.00  32.207582
25               Frosted Flakes   K    C  ...    1.00  0.75  31.435973
26          Frosted Mini-Wheats   K    C  ...    1.00  0.80  58.345141
28                Fruitful Bran   K    C  ...    1.33  0.67  41.015492
38  Just Right Crunchy  Nuggets   K    C  ...    1.00  1.00  36.523683
39       Just Right Fruit & Nut   K    C  ...    1.30  0.75  36.471512
46    [...]<jupyter_text>Question 5In order to comply with new government regulations, all cereals must now come with a "Healthiness" rating. This rating is calculated based on this formula:    healthiness = (protein + fiber) / sugarCreate a new `healthiness` column populated with values based on the above formula.Then, determine the median healthiness value for only General Mills cereals (`mfr` = "G"), rounded to two decimal places.<jupyter_code>cereals['healthiness'] = (round((cereals['protein'] + cereals['fiber'])/cereals['sugars'],2)) 
General_mills = cereals.query("mfr == 'G'")
General_mills['healthiness'].median()
# cereals.head(10)<jupyter_output><empty_output><jupyter_text>Problem Group 3For the questions in this group, you'll work with the Titanic Dataset found at this url: [https://raw.githubusercontent.com/byui-cse/cse450-course/master/data/titanic.csv](https://raw.githubusercontent.com/byui-cse/cse450-course/master/data/titanic.csv)  Question 6After loading the dataset into a pandas DataFrame, create a new column called `NameGroup` that contains the first letter of the passenger's surname in lower case.Note that in the dataset, passenger's names are provided in the `Name` column and are listed as:    Surname, Given namesFor example, if a passenger's `Name` is `Braund, Mr. <NAME>`, the `NameGroup` column should contain the value `b`.Then count how many passengers have a `NameGroup` value of `k`.<jupyter_code>titanic = pd.read_csv("https://raw.githubusercontent.com/byui-cse/cse450-course/master/data/titanic.csv")
titanic.head(20)
titanic.info()
NameGroup = titanic['Name'].str.split(',').str.get(0).str.get(0).str.lower()
kcount = titanic.where(titanic['Name'].str.split(',').str.get(0).str.get(0).str.lower() == 'k',0)
# kcount = titanic.where(titanic['Name'].str.split(',').str.get(0).str.get(0).str.lower()== 'k').value_counts()
# letter = names.str.get(0)
kcount = kcount.query('Name != 0')
kcount['Name'].count()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11079178042822245, 'fraction_numerical': 0.05877281218565886, 'mean_word_length': 3.441608168474793, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 9, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '620565', 'license': 'Apache-2.0', 'n_tokens_mistral': 2489, 'n_tokens_neox': 2193, 'n_words': 704, 'path': 'Copy_of_Assessment.ipynb', 'repo_name': 'jdonaldson40505/bat', 'size': '6964'}