diff --git a/1/Labo1.ipynb b/1/Labo1.ipynb index 2e6c50f..a35ee9e 100644 --- a/1/Labo1.ipynb +++ b/1/Labo1.ipynb @@ -91,15 +91,17 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "naam plsbeppe\n", - "leeftijd pls22\n", + "naam pls\n", + "beppe\n", + "leeftijd pls\n", + "22\n", "hallo beppe je bent nu 22 en je zal 100 jaar oud worden in het jaar 2097\n" ] } @@ -185,7 +187,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 3, "metadata": {}, "outputs": [ { @@ -193,7 +195,10 @@ "output_type": "stream", "text": [ "gent\n", - "['o', 'o']\n" + "['o', 'o']\n", + "zit erin\n", + "{'d', 'b', 'n', 'r', 'o', 'e'}\n", + "{'d', 'b'}\n" ] } ], @@ -201,11 +206,6 @@ "sing = ({9820:'lemberge',9000:'gent'},)\n", "print(sing[0].get(9000))\n", "\n", - "\n", - "\n", - "\n", - "\n", - "\n", "l1 = ['b','r','o','o','d'] #of b r o en d ?\n", "l2 = ['b','e', 'n', 'e', 'd', 'e', 'n']# of b e n d\n", "\n", @@ -219,25 +219,27 @@ "\n", "print(klinkers(l1))\n", "\n", + "set1 = set(l1)\n", + "set2 = set(l2)\n", "\n", - "\n", - "#is dit wa ge van mij verwacht?\n", - "l3 = l1+l2\n", - "print(l3)\n", - "\n", - "\n", - "l3.append('item naar keuze')\n", - "\n", - "\n", - "if 'r' in l3:\n", + "if 'r' in set1 or 'r' in set2:\n", " print('zit erin')\n", "else:\n", " print('zit er niet in')\n", "\n", - " \n", - " \n", "\n", "\n", + "#s.union(t)\n", + "#s | t\n", + "#new set with elements from both s and t\n", + "#s.intersection(t)\n", + "#s & t\n", + "#new set with elements common to s and t\n", + " \n", + "unie = set1 | set2\n", + "doorsnee = set1 & set2\n", + "print(\"{}\\n{}\".format(unie, doorsnee))\n", + "\n", "\n", "\n" ] @@ -765,10 +767,7 @@ " dic[category] = [entry]\n", " \n", " return dic \n", - " \n", - " \n", - " \n", - " \n", + " \n", " \n", "dic = parser(lines)\n", "for k,v in dic.items():\n", @@ -790,6 +789,117 @@ "Tip: https://www.machinelearningplus.com/plots/matplotlib-tutorial-complete-guide-python-plot-examples/" ] }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXQAAAD8CAYAAABn919SAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAADL9JREFUeJzt3VGIXQedx/HvbxtFWyutdBRtmk2F0l0pupVBqgV3aS2b1dL64EKLLdm1S152axVBW3wIfVkERRRclNDWFgyVpVYsom5DVcpCLTuppaZN14q6bTSakbIq9aEG//sw1yU7m2Ry7zmZO/Pv9wNh5p6c3PM/k8mXkzP3nJuqQpK0+f3JvAeQJI3DoEtSEwZdkpow6JLUhEGXpCYMuiQ1YdAlqQmDLklNGHRJamLLem7svPPOq+3bt6/nJiVp09u/f/+vqmphrfXWNejbt29naWlpPTcpSZtekv86lfU85SJJTRh0SWrCoEtSEwZdkpow6JLUhEGXpCYMuiQ1YdAlqQmDLklNrOuVoptBbs/oz1m7fSNuSaefR+iS1IRBl6QmDLokNWHQJakJgy5JTRh0SWrCoEtSEwZdkpow6JLUhEGXpCYMuiQ1sWbQk9yV5EiSA8cs+2SSp5M8keSrSc45vWNKktZyKkfodwM7Vi3bB1xSVW8GfgjcNvJckqQprRn0qnoYeH7Vsger6ujk4feAradhNknSFMY4h/4B4JsjPI8kaYBBQU/yceAosPck6+xKspRkaXl5ecjmJEknMXPQk+wErgbeX1UnfAeHqtpTVYtVtbiwsDDr5iRJa5jpHYuS7AA+BvxlVf1u3JEkSbM4lZct3gs8Alyc5FCSm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nF++FrgQeANwVpIb5juVjifJx1k5Hbt3nnOsR9BP6RYBm0mSl7ES871Vdf+85xngcuCaJD9l5VTYFUm+NN+RBjkEHKqqP/6P6T5WAr9ZvQv4SVUtV9XvgfuBd8x5pqF+meT1AJOPR+Y8z2BJdgJXA++vOb8OfD2C3uoWAUnCyjnag1X16XnPM0RV3VZVW6tqOyt/L9+uqk17BFhVvwCeS3LxZNGVwFNzHGmoZ4HLkpw5+b67kk38Q96JB4Cdk893Al+b4yyDJdkBfAy4pqp+N+95TnvQJz8w+OMtAg4C/7rJbxFwOXAjK0ezj09+vXveQ+l/3QzsTfIE8BfAP895nplN/qdxH/AY8ANW/r1uqCsTTybJvcAjwMVJDiW5CfgEcFWSZ4CrJo83hRPsz+eAs4F9kxZ8Ya4zeqWoJPXglaKS1IRBl6QmDLokNWHQJakJgy5JTRh0SWrCoEtSEwZdkpr4H6lE6TGKlz02AAAAAElFTkSuQmCC\n", + "text/plain": [ + "
" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "import matplotlib.pyplot as plt\n", + "\n", + "\n", + "with open('DataLabo1_01.txt', 'r') as infile:\n", + " lines = infile.readlines()\n", + "\n", + " \n", + "\n", + "def parser(data):\n", + " dic = {}\n", + " for l in data:\n", + " seg = l.split(' ')\n", + " dat = seg.pop().replace('\\n','')\n", + " naam = ' '.join(seg)\n", + " dic[naam] = dat\n", + " return dic\n", + "\n", + "\n", + "\n", + "dic = parser(lines)\n", + "maanden = {}\n", + "\n", + "\n", + "\n", + "for i in range(1,13):\n", + " maanden[i] = 0\n", + "\n", + "for k,v in dic.items():\n", + " temp = int(v[0:2])\n", + " maanden[temp] += 1\n", + "\n", + " \n", + "\n", + "plt.bar(list(maanden.keys()), maanden.values(), color='g')\n", + "plt.show()" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'youth_hostel': 50, 'yard': 50, 'wrestling_ring': 50, 'wine_cellar': 100, 'windmill': 50, 'wind_farm': 50, 'wheat_field': 50, 'wet_bar': 50, 'wave': 50, 'watering_hole': 50}\n" + ] + }, + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX4AAAD9CAYAAAC7iRw+AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAGDNJREFUeJzt3Xu0nFWZ5/HvQxJobnLLgUYQQivS4oUokQEcFcFFK7aA3TDQg3RgMcPgeMHbKNiOgN2uJWOPiEuHHi42aWW4ekFdqB1iuKiAJiEEMCAIIUQQIje5GhKe+WPvIpXjueScqkOC+/tZK+tUvfXWu/f71t6/vWtXnZPITCRJ7dhgXVdAkvTCMvglqTEGvyQ1xuCXpMYY/JLUGINfkhpj8EtSYwx+SWqMwS9JjZm8risAMHXq1Jw2bdq6roYkvajMnz//d5k5MNbnrRfBP23aNObNm7euqyFJLyoRcc94nudSjyQ1xuCXpMYY/JLUGINfkhpj8EtSY0YN/oj4WkQ8GBG3dG3bOiJmR8Qd9edWdXtExJcj4s6IWBQRb5jIykuSxm5tZvznA+8YtO0kYE5m7grMqfcB3gnsWv8dD5zVn2pKkvpl1ODPzGuAhwdtPgSYVW/PAg7t2v5vWVwPbBkR2/erspKk3o13jX+7zLwfoP7ctm7fAbi3a79ldZskaT3R79/cjSG2Dfm/uUfE8ZTlIHbaaac+V0MTKU4b6mXurzxlyGYjqQ/GO+N/oLOEU38+WLcvA17Wtd+OwH1DHSAzz87MGZk5Y2BgzH9qQpI0TuMN/u8CM+vtmcDlXdv/vn67Z2/gsc6SkCRp/TDqUk9EXAjsB0yNiGXAKcDngUsi4jhgKXB43f0K4CDgTuAp4NgJqLMkqQejBn9m/t0wDx0wxL4JvL/XSkmSJo6/uStJjTH4JakxBr8kNcbgl6TGGPyS1BiD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TzGAAAAABJRU5ErkJggg==\n", + "text/plain": [ + "
" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "import matplotlib.pyplot as plt\n", + "\n", + "with open('DataLabo1_02.txt', 'r') as infile:\n", + " lines = infile.readlines()\n", + " \n", + "def parser(data):\n", + " dic = {}\n", + " for l in data:\n", + " entry = l.split('/')[-1].replace('\\n','') #moest het volledige path nodig zijn is het gewoon l\n", + " category = l.split('/')[2]\n", + " if category in dic:\n", + " dic[category].append(entry)\n", + " else:\n", + " dic[category] = [entry]\n", + " \n", + " return dic \n", + " \n", + "dic = parser(lines)\n", + "lijst = {}\n", + "c=0\n", + "for key in reversed(list(dic.keys())):\n", + " lijst[key]=len(dic[key])\n", + " c+=1\n", + " if c > 9:\n", + " break \n", + " \n", + "plt.bar(list(lijst.keys()), lijst.values(), color='g', linewidth=10) \n", + "plt.show()\n", + "\n", + "\n", + "\n" + ] + }, { "cell_type": "code", "execution_count": null, @@ -814,7 +924,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.2" + "version": "3.6.5" } }, "nbformat": 4,