Answer To: The goal of this assignment is to practice working with CSV files and using NumPy functions. Please...
Sudipta answered on Oct 10 2021
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Mohamed Aljahani "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Assignment 01 - Current Date: 2020-10-10"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" Sex Weight_Sep Weight_Apr BMI_Sep BMI_Apr\n",
"0 M 72 59 22.02 18.14\n",
"1 M 97 86 19.70 17.44\n",
"2 M 74 69 24.09 22.43\n",
"3 M 93 88 26.97 25.57\n",
"4 F 68 64 21.51 20.10\n",
"5 M 59 55 18.69 17.40\n",
"6 F 64 60 24.24 22.88\n",
"7 F 56 53 21.23 20.23\n",
"8 F 70 68 30.26 29.24\n",
"9 F 58 56 21.88 21.02\n",
"10 F 50 47 17.63 16.89\n",
"11 M 71 69 24.57 23.85\n",
"12 M 67 66 20.68 20.15\n",
"13 F 56 55 20.97 20.36\n",
"14 F 70 68 27.30 26.73\n",
"15 F 61 60 23.30 22.88\n",
"16 F 53 52 19.48 19.24\n",
"17 M 92 92 24.74 24.69\n",
"18 F 57 58 20.69 20.79\n",
"19 M 67 67 20.49 20.60\n",
"20 F 58 58 21.09 21.24\n",
"21 F 49 50 18.37 18.53\n",
"22 M 68 68 22.40 22.61\n",
"23 F 69 69 28.17 28.43\n",
"24 M 87 88 23.60 23.81\n",
"25 M 81 82 26.52 26.78\n",
"26 M 60 61 18.89 19.27\n",
"27 F 52 53 19.31 19.75\n",
"28 M 70 71 20.96 21.32\n",
"29 F 63 64 21.78 22.22\n",
".. .. ... ... ... ...\n",
"37 F 63 65 23.87 24.67\n",
"38 F 54 56 18.61 19.34\n",
"39 F 56 58 21.73 22.58\n",
"40 M 54 56 18.93 19.72\n",
"41 M 73 75 25.88 26.72\n",
"42 M 77 79 28.59 29.53\n",
"43 F 63 66 21.89 22.79\n",
"44 F 51 54 18.31 19.28\n",
"45 F 59 62 19.64 20.63\n",
"46 F 65 68 23.02 24.10\n",
"47 F 53 56 20.63 21.91\n",
"48 F 62 65 22.61 23.81\n",
"49 F 55 58 22.03 23.42\n",
"50 M 74 77 20.31 21.34\n",
"51 M 74 78 20.31 21.36\n",
"52 M 64 68 19.59 20.77\n",
"53 M 64 68 21.05 22.31\n",
"54 F 57 61 23.47 25.11\n",
"55 F 64 68 22.84 24.29\n",
"56 F 60 64 19.50 20.90\n",
"57 M 64 68 18.51 19.83\n",
"58 M 66 71 21.40 22.97\n",
"59 F 52 57 17.72 19.42\n",
"60 M 71 77 22.26 23.87\n",
"61 F 55 60 21.64 23.81\n",
"62 M 65 71 22.51 24.45\n",
"63 M 75 82 23.69 25.80\n",
"64 F 42 49 15.08 17.74\n",
"65 M 74 82 22.64 25.33\n",
"66 M 94 105 36.57 40.86\n",
"\n",
"[67 rows x 5 columns]\n"
]
}
],
"source": [
"import pandas as pd\n",
"import numpy as np\n",
"#Function defined for reading the data from a csv file.\n",
"def readFile():\n",
" df=pd.read_csv(r'Give path to the csv file in your computer\\freshman_kgs.csv')\n",
" df=pd.DataFrame(df)\n",
" return(df)\n",
"ds=readFile();\n",
"print(ds);"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0 72\n",
"1 97\n",
"2 74\n",
"3 93\n",
"4 68\n",
"5 59\n",
"6 64\n",
"7 56\n",
"8 70\n",
"9 58\n",
"10 50\n",
"11 71\n",
"12 67\n",
"13 56\n",
"14 70\n",
"15 61\n",
"16 53\n",
"17 92\n",
"18 57\n",
"19 67\n",
"20 58\n",
"21 49\n",
"22 68\n",
"23 69\n",
"24 87\n",
"25 81\n",
"26 60\n",
"27 52\n",
"28 70\n",
"29 63\n",
" ..\n",
"37 63\n",
"38 54\n",
"39 56\n",
"40 54\n",
"41 73\n",
"42 77\n",
"43 63\n",
"44 51\n",
"45 59\n",
"46 65\n",
"47 53\n",
"48 62\n",
"49 55\n",
"50 74\n",
"51 74\n",
"52 64\n",
"53 64\n",
"54 57\n",
"55 64\n",
"56 60\n",
"57 64\n",
"58 66\n",
"59 52\n",
"60 71\n",
"61 55\n",
"62 65\n",
"63 75\n",
"64 42\n",
"65 74\n",
...