diff --git a/02_activities/assignments/assignment_2.ipynb b/02_activities/assignments/assignment_2.ipynb index b9b87742..c99e24a6 100644 --- a/02_activities/assignments/assignment_2.ipynb +++ b/02_activities/assignments/assignment_2.ipynb @@ -34,7 +34,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 7, "id": "4a3485d6-ba58-4660-a983-5680821c5719", "metadata": {}, "outputs": [], @@ -50,7 +50,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 5, "id": "a431d282-f9ca-4d5d-8912-71ffc9d8ea19", "metadata": {}, "outputs": [ @@ -167,7 +167,7 @@ "4 70 usa ford torino " ] }, - "execution_count": 2, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } @@ -200,7 +200,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 8, "id": "5d79f1cf", "metadata": {}, "outputs": [ @@ -257,7 +257,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 9, "id": "ac306190", "metadata": {}, "outputs": [ @@ -276,7 +276,7 @@ "dtype: object" ] }, - "execution_count": 22, + "execution_count": 9, "metadata": {}, "output_type": "execute_result" } @@ -305,34 +305,134 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 10, "id": "9f034a5d", "metadata": {}, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - " mpg cylinders displacement horsepower weight acceleration \\\n", - "19 26.0 4 97.0 46.0 1835 20.5 \n", - "102 26.0 4 97.0 46.0 1950 21.0 \n", - "326 43.4 4 90.0 48.0 2335 23.7 \n", - "325 44.3 4 90.0 48.0 2085 21.7 \n", - "244 43.1 4 90.0 48.0 1985 21.5 \n", - "\n", - " model_year origin name \n", - "19 70 europe volkswagen 1131 deluxe sedan \n", - "102 73 europe volkswagen super beetle \n", - "326 80 europe vw dasher (diesel) \n", - "325 80 europe vw rabbit c (diesel) \n", - "244 78 europe volkswagen rabbit custom diesel \n" - ] + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
mpgcylindersdisplacementhorsepowerweightaccelerationmodel_yearoriginname
11616.08400.0230.042789.573usapontiac grand prix
814.08455.0225.0442510.070usapontiac catalina
1314.08455.0225.0308610.070usabuick estate wagon (sw)
9512.08455.0225.0495111.073usabuick electra 225 custom
614.08454.0220.043549.070usachevrolet impala
\n", + "
" + ], + "text/plain": [ + " mpg cylinders displacement horsepower weight acceleration \\\n", + "116 16.0 8 400.0 230.0 4278 9.5 \n", + "8 14.0 8 455.0 225.0 4425 10.0 \n", + "13 14.0 8 455.0 225.0 3086 10.0 \n", + "95 12.0 8 455.0 225.0 4951 11.0 \n", + "6 14.0 8 454.0 220.0 4354 9.0 \n", + "\n", + " model_year origin name \n", + "116 73 usa pontiac grand prix \n", + "8 70 usa pontiac catalina \n", + "13 70 usa buick estate wagon (sw) \n", + "95 73 usa buick electra 225 custom \n", + "6 70 usa chevrolet impala " + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ "# Your answer here... \n", "\n", - "print(df.sort_values(by='horsepower').head(5))" + "##print(df.sort_values(by='horsepower').head(5))\n", + "\n", + "df.nlargest(5, 'horsepower')\n" ] }, { @@ -541,7 +641,7 @@ "id": "843f9eef", "metadata": {}, "source": [ - "> Your answer here... the slope" + "> Your answer here... the slope and the intercept." ] }, {