diff --git a/module3/exo3/exercice.ipynb b/module3/exo3/exercice.ipynb index 77a2fc84d647710611780645d5d3e75c798a426f..8bdff6f453c56d0799fe7da3256a42aaedc5aa24 100644 --- a/module3/exo3/exercice.ipynb +++ b/module3/exo3/exercice.ipynb @@ -1067,6 +1067,7 @@ } ], "source": [ + "# create a barplot\n", "plt.bar(my_data[\"Year\"], my_data[\"Wheat\"])" ] }, @@ -1079,16 +1080,16 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 39, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "" + "" ] }, - "execution_count": 7, + "execution_count": 39, "metadata": {}, "output_type": "execute_result" }, @@ -1106,13 +1107,13 @@ } ], "source": [ + "# create a plot\n", "plt.plot(my_data[\"Year\"], my_data[\"Wages\"], \"r\")\n", "\n", - " \n", - "y1 = my_data[\"Wages\"]\n", - "x = my_data[\"Year\"]\n", - " \n", - "plt.fill_between(x, y1, color='#539ecd')" + "# fill area between curve and axis\n", + "x = my_data[\"Year\"] \n", + "y = my_data[\"Wages\"] \n", + "plt.fill_between(x, y, color='#539ecd')" ] }, { @@ -1124,16 +1125,16 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 43, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "" + "" ] }, - "execution_count": 8, + "execution_count": 43, "metadata": {}, "output_type": "execute_result" }, @@ -1151,17 +1152,14 @@ } ], "source": [ + "# create two plots in the same graph\n", + "p = plt.bar(my_data[\"Year\"], my_data[\"Wheat\"]), \n", + "plt.plot(my_data[\"Year\"], my_data[\"Wages\"], \"r\")\n", "\n", - "\n", - "p = plt.bar(my_data[\"Year\"], my_data[\"Wheat\"]), plt.plot(my_data[\"Year\"], my_data[\"Wages\"], \"r\")\n", - "\n", - "\n", + "# fill area between curve and axis\n", "x = my_data[\"Year\"]\n", - "y2 = my_data[\"Wages\"]\n", - "\n", - "\n", - "plt.fill_between(x, y2, color='#539ecd')\n", - "\n" + "y = my_data[\"Wages\"]\n", + "plt.fill_between(x, y, color='#539ecd')" ] }, { @@ -1725,6 +1723,7 @@ } ], "source": [ + "# Calculate the purchase_power \n", "# purchase_power = wages / wheat\n", "my_data[\"Purchase_Power\"] = my_data[\"Wages\"] / my_data[\"Wheat\"]\n", "\n",