Commit 9c53451a authored by christian.foerster's avatar christian.foerster

update

parent 7cb62627
......@@ -311,7 +311,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.8"
"version": "3.7.4"
}
},
"nbformat": 4,
......
......@@ -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,
......
......@@ -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,
......
......@@ -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",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment