diff --git a/Numpy.ipynb b/Numpy.ipynb index 387f7177b1fb673167bd0cf4a1321e9721f2b331..0b9cb35800aecee75c7ac9f3e4d86ee55a5eb012 100644 --- a/Numpy.ipynb +++ b/Numpy.ipynb @@ -311,7 +311,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.8" + "version": "3.7.4" } }, "nbformat": 4, diff --git a/Optimization.ipynb b/Optimization.ipynb index fb73519d66b2e4602771b3e2de48953ad9089153..9dae9c6978ade382afd4e39efb3103fa425de622 100644 --- a/Optimization.ipynb +++ b/Optimization.ipynb @@ -46,15 +46,36 @@ "outputs": [], "source": [ "#renaming columns\n", - "df.columns=[\"h\",\"Q\"]\n", - "\n", + "df.columns=[\"h\",\"Q\"]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ "# h -> [m], Q -> [m³/s]\n", "df[\"h\"] = df[\"h\"]/1000\n", - "df[\"Q\"] = df[\"Q\"]/1000\n", - "\n", + "df[\"Q\"] = df[\"Q\"]/1000" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ "# dropping na's\n", - "df.dropna(how=\"any\",inplace=True)\n", - "\n", + "df.dropna(how=\"any\",inplace=True)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ "# removing h<=0, Q<=0\n", "df = df[(df[\"h\"]>0) & (df[\"Q\"]>0)]" ] @@ -223,8 +244,8 @@ "# optimization result!\n", "kst = result_manning.x[0]\n", "\n", - "# converting predicted values\n", - "manning_data = df[[\"h\"]]\n", + "# converting predicted values (creating a new dataframe that contain our manning h and Q)\n", + "manning_data = df[[\"h\"]].copy()\n", "manning_data[\"Q\"] = ManningCIR(df.h.values,r,kst,I)\n", "\n", "# sorting for plot\n", @@ -383,7 +404,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.8" + "version": "3.7.4" } }, "nbformat": 4, diff --git a/Pandas.ipynb b/Pandas.ipynb index 43099e279b75987922f293d79b1c7ebad5d20276..f28d5984992f1529b05c1a92e4f81da1191ec786 100755 --- a/Pandas.ipynb +++ b/Pandas.ipynb @@ -93,6 +93,23 @@ "df2" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Task 1 \n", + "\n", + "Create a Dataframe from a list.\n", + "Call the DataFrame **df_mine**." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, { "cell_type": "markdown", "metadata": {}, @@ -162,6 +179,25 @@ "print(df[[\"a\",\"b\"]][:3])\n" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Task 2\n", + "\n", + "Play around with indexing:\n", + "- try to get a column\n", + "- try to get row\n", + "- try to get a cell" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, { "cell_type": "markdown", "metadata": {}, @@ -189,6 +225,22 @@ "plt.tight_layout()" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Task 3\n", + "\n", + "Plot column 'a' with a title!" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, { "cell_type": "markdown", "metadata": {}, @@ -361,7 +413,7 @@ "outputs": [], "source": [ "# column bind (axis=1) (row bind axis=0)\n", - "newdf=pd.concat([df[\"A\"],df[\"exponential_column\"]],axis=1)" + "newdf=pd.concat([df[\"a\"],df[\"exponential_column\"]],axis=1)" ] }, { @@ -595,7 +647,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.8" + "version": "3.7.4" } }, "nbformat": 4, diff --git a/Python Tutorial - Basics.ipynb b/Python Tutorial - Basics.ipynb index 6a826c33e1245a509177e4e3ce327ef1d85db8ec..d37735fbcfb1cbef7f4ca499d78546c5cc894297 100755 --- a/Python Tutorial - Basics.ipynb +++ b/Python Tutorial - Basics.ipynb @@ -72,13 +72,6 @@ "a" ] }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "**Mind the difference between \\/ and \\/\\/**" - ] - }, { "cell_type": "markdown", "metadata": {}, @@ -105,6 +98,27 @@ "print(r\"C:\\adg\\ggj\")" ] }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'42323dsfdsagfdsafsa .. . .99.900'" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "2**99%57\n", + "\"42323dsfdsagfdsafsa .. . .%.3f\" %99.9" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -632,7 +646,7 @@ "- What's the remainder of $2^{99}$ divided by $57$? \n", "- If you were to write a little database, that gets one file for every day containing data for that day. \n", "And you want to store the file locations in a basic python data structure. Which one would you use and why? \n", - "- If you want to check two large python lists for commen values, how would you do it?" + "- If you want to check two large python lists for common values, how would you do it?" ] }, { @@ -654,7 +668,7 @@ "# summing up the values of a list\n", "summe=0\n", "for num in [1,2,3,4]:\n", - " # everything that is endeted is within the loop\n", + " # everything that is indeted is within the loop\n", " summe+=num\n", " print(num)\n", " \n",