diff --git a/UFCFVQ-15-M Programming Task 2 Template.ipynb b/UFCFVQ-15-M Programming Task 2 Template.ipynb index 4bfa921de5bffa7ffce6816efc1f62cbc9ac82b6..7afe2694a8539dec74558e00dc7fc88d07ec7a5e 100644 --- a/UFCFVQ-15-M Programming Task 2 Template.ipynb +++ b/UFCFVQ-15-M Programming Task 2 Template.ipynb @@ -121,11 +121,48 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "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 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": [ - "# add code here" + "# Importing the pandas library\n", + "\n", + "import pandas as pd\n", + "\n", + "# Read data, from a CSV file in a DataFrame1 & DataFrame2.\n", + "\n", + "\n", + "Dataframe1 = pd.read_csv('task2a.csv')\n", + "Dataframe2 = pd.read_csv('task2b.csv', names=['id_student', 'click_events'])\n", + "\n", + "# Merging DataFrame1 & DataFrame2 into a new DataFrame.\n", + "# How ? By utilizing the 'inner' merge technique we combine the rows, in both DataFrames that share common 'id_student' values.\n", + "\n", + "merged_data_frame = pd.merge(Dataframe1, Dataframe2, on='id_student', how='inner')\n", + "\n", + "# Display the five rows of the mergd DataFrame.\n", + "\n", + "print(merged_data_frame.head())\n" ] }, { @@ -145,12 +182,30 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 9, "metadata": {}, - "outputs": [], - "source": [ - "# add code here" - ] + "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 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": [] }, { "cell_type": "markdown",