From e775ccdb415f7df47750a6468df55a0315e0ea77 Mon Sep 17 00:00:00 2001 From: FelipSamitier <76517798+FelipSamitier@users.noreply.github.com> Date: Mon, 18 Jan 2021 20:26:06 +0100 Subject: [PATCH] Add files via upload --- your-code/main.ipynb | 325 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 285 insertions(+), 40 deletions(-) diff --git a/your-code/main.ipynb b/your-code/main.ipynb index f50ae3d..70c14a3 100755 --- a/your-code/main.ipynb +++ b/your-code/main.ipynb @@ -18,11 +18,13 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ - "# your code here" + "# your code here\n", + "import numpy as np\n", + "import pandas as pd" ] }, { @@ -34,7 +36,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 32, "metadata": {}, "outputs": [], "source": [ @@ -43,11 +45,33 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 39, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0 5.7\n", + "1 75.2\n", + "2 74.4\n", + "3 84.0\n", + "4 66.5\n", + "5 66.3\n", + "6 55.8\n", + "7 75.7\n", + "8 29.1\n", + "9 43.7\n", + "dtype: float64\n" + ] + } + ], "source": [ - "# your code here" + "# your code here\n", + "\n", + "panda_lst = pd.Series(lst)\n", + "\n", + "print(panda_lst)\n" ] }, { @@ -61,11 +85,24 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 36, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "74.4" + ] + }, + "execution_count": 36, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "# your code here" + "# your code here\n", + "\n", + "panda_lst[2]\n" ] }, { @@ -77,7 +114,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 40, "metadata": {}, "outputs": [], "source": [ @@ -95,11 +132,33 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 42, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " 0 1 2 3 4\n", + "0 53.1 95.0 67.5 35.0 78.4\n", + "1 61.3 40.8 30.8 37.8 87.6\n", + "2 20.6 73.2 44.2 14.6 91.8\n", + "3 57.4 0.1 96.1 4.2 69.5\n", + "4 83.6 20.5 85.4 22.8 35.9\n", + "5 49.0 69.0 0.1 31.8 89.1\n", + "6 23.3 40.7 95.0 83.8 26.9\n", + "7 27.6 26.4 53.8 88.8 68.5\n", + "8 96.6 96.4 53.4 72.4 50.1\n", + "9 73.7 39.0 43.2 81.6 34.7\n" + ] + } + ], "source": [ - "# your code here" + "# your code here\n", + "\n", + "panda_b = pd.DataFrame(b)\n", + "\n", + "print(panda_b)" ] }, { @@ -111,7 +170,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 43, "metadata": {}, "outputs": [], "source": [ @@ -120,11 +179,33 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 46, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " Score_1 Score_2 Score_3 Score_4 Score_5\n", + "0 53.1 95.0 67.5 35.0 78.4\n", + "1 61.3 40.8 30.8 37.8 87.6\n", + "2 20.6 73.2 44.2 14.6 91.8\n", + "3 57.4 0.1 96.1 4.2 69.5\n", + "4 83.6 20.5 85.4 22.8 35.9\n", + "5 49.0 69.0 0.1 31.8 89.1\n", + "6 23.3 40.7 95.0 83.8 26.9\n", + "7 27.6 26.4 53.8 88.8 68.5\n", + "8 96.6 96.4 53.4 72.4 50.1\n", + "9 73.7 39.0 43.2 81.6 34.7\n" + ] + } + ], "source": [ - "# your code here" + "# your code here\n", + "\n", + "panda_b.columns = colnames\n", + "\n", + "print(panda_b)" ] }, { @@ -136,11 +217,33 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 51, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " Score_1 Score_2 Score_3\n", + "0 53.1 95.0 67.5\n", + "1 61.3 40.8 30.8\n", + "2 20.6 73.2 44.2\n", + "3 57.4 0.1 96.1\n", + "4 83.6 20.5 85.4\n", + "5 49.0 69.0 0.1\n", + "6 23.3 40.7 95.0\n", + "7 27.6 26.4 53.8\n", + "8 96.6 96.4 53.4\n", + "9 73.7 39.0 43.2\n" + ] + } + ], "source": [ - "# your code here" + "# your code here\n", + "\n", + "subset_panda_b = panda_b[['Score_1', 'Score_2','Score_3']]\n", + "\n", + "print(subset_panda_b)" ] }, { @@ -152,11 +255,24 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 52, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "56.95000000000001" + ] + }, + "execution_count": 52, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "# your code here" + "# your code here\n", + "\n", + "panda_b[\"Score_3\"].mean()" ] }, { @@ -168,11 +284,24 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 53, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "88.8" + ] + }, + "execution_count": 53, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "# your code here" + "# your code here\n", + "\n", + "panda_b[\"Score_4\"].max()" ] }, { @@ -184,11 +313,24 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 54, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "40.75" + ] + }, + "execution_count": 54, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "# your code here" + "# your code here\n", + "\n", + "panda_b[\"Score_2\"].median()" ] }, { @@ -200,7 +342,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 55, "metadata": {}, "outputs": [], "source": [ @@ -221,11 +363,33 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 58, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " Description Quantity UnitPrice Revenue\n", + "0 LUNCH BAG APPLE DESIGN 1 1.65 1.65\n", + "1 SET OF 60 VINTAGE LEAF CAKE CASES 24 0.55 13.20\n", + "2 RIBBON REEL STRIPES DESIGN 1 1.65 1.65\n", + "3 WORLD WAR 2 GLIDERS ASSTD DESIGNS 2880 0.18 518.40\n", + "4 PLAYING CARDS JUBILEE UNION JACK 2 1.25 2.50\n", + "5 POPCORN HOLDER 7 0.85 5.95\n", + "6 BOX OF VINTAGE ALPHABET BLOCKS 1 11.95 11.95\n", + "7 PARTY BUNTING 4 4.95 19.80\n", + "8 JAZZ HEARTS ADDRESS BOOK 10 0.19 1.90\n", + "9 SET OF 4 SANTA PLACE SETTINGS 48 1.25 60.00\n" + ] + } + ], "source": [ - "# your code here" + "# your code here\n", + "\n", + "dict = pd.DataFrame.from_dict(orders)\n", + "\n", + "print(dict)" ] }, { @@ -237,11 +401,27 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 60, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "2978\n", + "637.0\n" + ] + } + ], "source": [ - "# your code here" + "# your code here\n", + "\n", + "total_quantity = dict[\"Quantity\"].sum()\n", + "\n", + "revenue_generated = dict[\"Revenue\"].sum()\n", + "\n", + "print(total_quantity)\n", + "print(revenue_generated)" ] }, { @@ -253,11 +433,27 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 61, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "516.75\n" + ] + } + ], "source": [ - "# your code here" + "# your code here\n", + "\n", + "most_exp = dict[\"Revenue\"].max()\n", + "\n", + "least_exp = dict[\"Revenue\"].min()\n", + "\n", + "diff = most_exp - least_exp\n", + "\n", + "print(diff)" ] } ], @@ -277,7 +473,56 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.2" + "version": "3.8.5" + }, + "toc": { + "base_numbering": 1, + "nav_menu": {}, + "number_sections": true, + "sideBar": true, + "skip_h1_title": false, + "title_cell": "Table of Contents", + "title_sidebar": "Contents", + "toc_cell": false, + "toc_position": {}, + "toc_section_display": true, + "toc_window_display": false + }, + "varInspector": { + "cols": { + "lenName": 16, + "lenType": 16, + "lenVar": 40 + }, + "kernels_config": { + "python": { + "delete_cmd_postfix": "", + "delete_cmd_prefix": "del ", + "library": "var_list.py", + "varRefreshCmd": "print(var_dic_list())" + }, + "r": { + "delete_cmd_postfix": ") ", + "delete_cmd_prefix": "rm(", + "library": "var_list.r", + "varRefreshCmd": "cat(var_dic_list()) " + } + }, + "position": { + "height": "323.722px", + "left": "1375.45px", + "right": "20px", + "top": "120px", + "width": "350px" + }, + "types_to_exclude": [ + "module", + "function", + "builtin_function_or_method", + "instance", + "_Feature" + ], + "window_display": false } }, "nbformat": 4,