Commit aa526908 authored by Claas Testuser's avatar Claas Testuser

fix encoding problem on windows

parent ac2579e3
......@@ -53,7 +53,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# import python packages\n",
......@@ -91,9 +93,9 @@
"data = r.text\n",
"\n",
"# write data to disk. Note: there is a slight difference between python2 and python3 \n",
"with open('data/boknis.txt', 'w+') as outfile:\n",
"with open('data/boknis.txt', 'wb') as outfile:\n",
" #outfile.write(data.encode(r.encoding)) # use this syntax with python 2\n",
" outfile.write(data) # use this syntax with python3"
" outfile.write(data.encode('utf-8')) # use this syntax with python3"
]
},
{
......@@ -185,7 +187,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"sns.boxplot(x='Depth water [m]', y='Temp [°C]', data=df)"
......@@ -203,7 +207,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# group data into bins by values in column'Depth water [m]'. Count number of measurements for each depth.\n",
......@@ -220,7 +226,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# pandas ways of filtering and selecting data can be confusing at first...\n",
......@@ -238,7 +246,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# plot temp @25m depth\n",
......@@ -259,7 +269,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"df.loc[df['Depth water [m]'] == 26, 'Depth water [m]'] = 25\n",
......@@ -278,7 +290,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"sns.boxplot(x='Depth water [m]', y='Temp [°C]', data=df)\n",
......@@ -307,6 +321,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true,
"scrolled": false
},
"outputs": [],
......@@ -317,7 +332,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# slice data to contain only one sampling depth\n",
......@@ -338,7 +355,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import sqlite3\n",
......
......@@ -95,9 +95,9 @@
"data = r.text\n",
"\n",
"# write data to disk. Note: there is a slight difference between python2 and python3 \n",
"with open('data/boknis.txt', 'w+') as outfile:\n",
"with open('data/boknis.txt', 'wb') as outfile:\n",
" #outfile.write(data.encode(r.encoding)) # use this syntax with python 2\n",
" outfile.write(data) # use this syntax with python3"
" outfile.write(data.encode('utf-8')) # use this syntax with python3"
]
},
{
......@@ -189,7 +189,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"sns.boxplot(x='Depth water [m]', y='Temp [°C]', data=df)"
......@@ -207,7 +209,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# group data into bins by values in column'Depth water [m]'. Count number of measurements for each depth.\n",
......@@ -224,7 +228,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# pandas ways of filtering and selecting data can be confusing at first...\n",
......@@ -244,7 +250,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"sns.boxplot(x='Depth water [m]', y='Temp [°C]', data=df)\n",
......@@ -273,6 +281,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true,
"scrolled": false
},
"outputs": [],
......@@ -283,7 +292,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# slice data to contain only one sampling depth\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