diff --git a/your-code/main.ipynb b/your-code/main.ipynb index f50ae3d..a4f9674 100755 --- a/your-code/main.ipynb +++ b/your-code/main.ipynb @@ -18,11 +18,13 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "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": 4, "metadata": {}, "outputs": [], "source": [ @@ -43,11 +45,17 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 72, "metadata": {}, "outputs": [], "source": [ - "# your code here" + "# your code here\n", + "new_series=pd.Series([],dtype=np.float64)\n", + "\n", + "new_series[\"Floats\"]=lst\n", + "\n", + "\n", + "\n" ] }, { @@ -61,11 +69,23 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 73, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "74.4" + ] + }, + "execution_count": 73, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "# your code here" + "# your code here\n", + "new_series[0][2]" ] }, { @@ -77,7 +97,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 74, "metadata": {}, "outputs": [], "source": [ @@ -95,11 +115,12 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 75, "metadata": {}, "outputs": [], "source": [ - "# your code here" + "# your code here\n", + "df = pd.DataFrame(b, columns = [\"a\", \"b\",\"c\",\"d\",\"e\"])" ] }, { @@ -111,7 +132,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 76, "metadata": {}, "outputs": [], "source": [ @@ -120,11 +141,12 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 77, "metadata": {}, "outputs": [], "source": [ - "# your code here" + "# your code here\n", + "df.columns=colnames" ] }, { @@ -136,11 +158,123 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 78, "metadata": {}, - "outputs": [], + "outputs": [ + { + "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", + "
Score_1Score_3Score_5
053.167.578.4
161.330.887.6
220.644.291.8
357.496.169.5
483.685.435.9
549.00.189.1
623.395.026.9
727.653.868.5
896.653.450.1
973.743.234.7
\n", + "
" + ], + "text/plain": [ + " Score_1 Score_3 Score_5\n", + "0 53.1 67.5 78.4\n", + "1 61.3 30.8 87.6\n", + "2 20.6 44.2 91.8\n", + "3 57.4 96.1 69.5\n", + "4 83.6 85.4 35.9\n", + "5 49.0 0.1 89.1\n", + "6 23.3 95.0 26.9\n", + "7 27.6 53.8 68.5\n", + "8 96.6 53.4 50.1\n", + "9 73.7 43.2 34.7" + ] + }, + "execution_count": 78, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "# your code here" + "# your code here\n", + "df_subset=df[['Score_1', 'Score_3', 'Score_5']]\n", + "df_subset" ] }, { @@ -152,11 +286,23 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 79, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "56.95000000000001" + ] + }, + "execution_count": 79, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "# your code here" + "# your code here\n", + "df[\"Score_3\"].mean()" ] }, { @@ -168,11 +314,23 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 80, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "88.8" + ] + }, + "execution_count": 80, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "# your code here" + "# your code here\n", + "df[\"Score_4\"].max()" ] }, { @@ -184,11 +342,23 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 81, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "40.75" + ] + }, + "execution_count": 81, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "# your code here" + "# your code here\n", + "df[\"Score_2\"].median()" ] }, { @@ -200,7 +370,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 82, "metadata": {}, "outputs": [], "source": [ @@ -221,11 +391,12 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 83, "metadata": {}, "outputs": [], "source": [ - "# your code here" + "# your code here\n", + "orders_df=pd.DataFrame(orders)\n" ] }, { @@ -237,11 +408,23 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 84, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Total quantity is: 2978\n", + "Total Revenue is: 637.0\n" + ] + } + ], "source": [ - "# your code here" + "# your code here\n", + "total_quantity=orders_df[\"Quantity\"].sum()\n", + "total_revenue=orders_df[\"Revenue\"].sum()\n", + "print(\"Total quantity is: \"+str(total_quantity)+\"\\nTotal Revenue is: \"+str(total_revenue))" ] }, { @@ -253,12 +436,36 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 133, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "11.77" + ] + }, + "execution_count": 133, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "# your code here" + "# your code here\n", + "#most_expansive=orders_df[\"UnitPrice\"][orders_df[\"UnitPrice\"]>orders_df[\"UnitPrice\"].median()].sort_values()\n", + "#least_expansive=orders_df[\"UnitPrice\"][orders_df[\"UnitPrice\"]