diff --git a/UFCFVQ-15-M Programming Task 2 Template.ipynb b/UFCFVQ-15-M Programming Task 2 Template.ipynb index 9e2af3d5b2fbd25a637375cd94982484365c2f9a..8bfd724b11ce18808cde0a0d4f2d662dfa80abab 100644 --- a/UFCFVQ-15-M Programming Task 2 Template.ipynb +++ b/UFCFVQ-15-M Programming Task 2 Template.ipynb @@ -231,31 +231,36 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 36, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - " Unnamed: 0 id_student gender age_band disability score click_events\n", - "0 0 11391 M 55<= N 82.0 934.0\n", - "1 1 28400 F 35-55 N 67.0 1435.0\n", - "2 2 31604 F 35-55 N 76.0 2158.0\n", - "3 3 32885 F 0-35 N 55.0 1034.0\n", - "4 4 38053 M 35-55 N 68.0 2445.0\n" + " Unnamed: 0 id_student gender region highest_education \\\n", + "0 0 11391 M East Anglian Region HE Qualification \n", + "1 1 28400 F Scotland HE Qualification \n", + "2 2 31604 F South East Region A Level or Equivalent \n", + "3 3 32885 F West Midlands Region Lower Than A Level \n", + "4 4 38053 M Wales A Level or Equivalent \n", + "\n", + " age_band disability final_result score click_events \n", + "0 55<= N Pass 82.0 934.0 \n", + "1 35-55 N Pass 67.0 1435.0 \n", + "2 35-55 N Pass 76.0 2158.0 \n", + "3 0-35 N Pass 55.0 1034.0 \n", + "4 35-55 N Pass 68.0 2445.0 \n" ] } ], "source": [ - "# Removing unnecessary rows from 'cleaned_data_frame' by using 'drop' method.\n", - "# The result will be stored in 'final_data_frame', which no longer includes 'region', 'final_result', 'highest_education' columns.\n", + "# Filtering unnecessary rows where 'click_events' is smaller than 10\n", + "filtered_data_frame = cleaned_data_frame[cleaned_data_frame['click_events'] >= 10]\n", "\n", - "final_data_frame = cleaned_data_frame.drop(columns=['region', 'final_result', 'highest_education'])\n", - "\n", - "# Displaying the Final DataFrame\n", - "\n", - "print(final_data_frame.head())\n" + "# Displaying the filtered DataFrame\n", + "print(filtered_data_frame.head())\n", + "\n" ] }, { @@ -275,11 +280,35 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 35, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " Unnamed: 0 id_student gender region highest_education \\\n", + "0 0 11391 M East Anglian Region HE Qualification \n", + "1 1 28400 F Scotland HE Qualification \n", + "2 2 31604 F South East Region A Level or Equivalent \n", + "3 3 32885 F West Midlands Region Lower Than A Level \n", + "4 4 38053 M Wales A Level or Equivalent \n", + "\n", + " age_band disability final_result final_mark click_events \n", + "0 55<= N Pass 82.0 934.0 \n", + "1 35-55 N Pass 67.0 1435.0 \n", + "2 35-55 N Pass 76.0 2158.0 \n", + "3 0-35 N Pass 55.0 1034.0 \n", + "4 35-55 N Pass 68.0 2445.0 \n" + ] + } + ], "source": [ - "# add code here" + "# Renaming the 'score' column to 'final_mark'\n", + "renamed_data_frame = filtered_data_frame.rename(columns={'score': 'final_mark'})\n", + "\n", + "# Displaying the DataFrame with the renamed column\n", + "print(renamed_data_frame.head())\n" ] }, {