login as: jaagup jaagup@lin2.tlu.ee's password: Access denied jaagup@lin2.tlu.ee's password: Last login: Sun Dec 3 16:14:29 2017 from eduroam.tlu.ee Disk quotas for user jaagup (uid 558): Filesystem blocks quota limit grace files quota limit grace /dev/mapper/clr0-opt 0 102400 128000 1 10 100 /dev/mapper/clr0-home2 1001800 3145728 3145728 14235 20000 20000 [jaagup@lin2 ~]$ cd public_html/ [jaagup@lin2 public_html]$ dir 5klass.txt index.html peokuulutus.html~ tunniplaan.txt~ abi.txt kml proov vanatunniplaan.txt andmed lootspillipoisid.jpg rebane.gif vanatunniplaan.txt~ andmed.tar Mailaulik.doc skriptkeeled veeb1 cv.html maps solomina.html dt peokuulutus.html tunniplaan.txt [jaagup@lin2 public_html]$ cd dt/ [jaagup@lin2 dt]$ dir uuring1 [jaagup@lin2 dt]$ cd uuring1/ [jaagup@lin2 uuring1]$ ls 5klass.txt kaisu2klass.txt klass2.txt vastus.txt eesnimed2.txt kaisuklass.txt klass2.txt~ ylevaade1.sh eesnimed.txt kaisuklass.txt~ sportlased.txt [jaagup@lin2 uuring1]$ ls -l total 44 -rw-rw-r-- 1 jaagup jaagup 531 Sep 22 14:00 5klass.txt -rw-rw-r-- 1 jaagup jaagup 29 Sep 22 11:41 eesnimed2.txt -rw-rw-r-- 1 jaagup jaagup 28 Sep 22 11:09 eesnimed.txt -rw-rw-r-- 1 jaagup jaagup 131 Sep 22 22:14 kaisu2klass.txt -rw-rw-r-- 1 jaagup jaagup 577 Sep 22 21:54 kaisuklass.txt -rw-rw-r-- 1 jaagup jaagup 577 Sep 22 21:54 kaisuklass.txt~ -rw-rw-r-- 1 jaagup jaagup 58 Sep 22 21:58 klass2.txt -rw-rw-r-- 1 jaagup jaagup 59 Sep 22 21:58 klass2.txt~ -rw-rw-r-- 1 jaagup jaagup 175 Sep 25 08:19 sportlased.txt -rw-rw-r-- 1 jaagup jaagup 73 Sep 22 13:44 vastus.txt -rw-rw-r-- 1 jaagup jaagup 281 Sep 22 13:31 ylevaade1.sh [jaagup@lin2 uuring1]$ more 5klass.txt eesnimi,pikkus,mass,sugu Juku,170,45,m Kati,160,35,n Mati,160,72,m Madis,165,53,m Mati,163,60,m Katrin,165,43,n Siim,151,38,m Martin,159,46,m Kadri,164,57,n Katariina,148,35,n Maria,143,38,n Marta,169,550,n Madis,156,65,m Mihkel,165,69,m Tiina,170,38,n Miia,145,68,n Siim,151,55,m Juhan,175,110,m Priit,156,63,m Kristjan,164,59,m Kristi,155,53,n Kristiina,158,62,n Killu,164,49,n Mart,170,69,m Kert,143,36,m Gert,152,67,m Lauri,156,53,m Moonika,164,58,n Jaanika,165,59,n Jaanus,164,63,m Jaan,162,65,m [jaagup@lin2 uuring1]$ more 5klass.txt | sort eesnimi,pikkus,mass,sugu Gert,152,67,m Jaan,162,65,m Jaanika,165,59,n Jaanus,164,63,m Juhan,175,110,m Juku,170,45,m Kadri,164,57,n Katariina,148,35,n Kati,160,35,n Katrin,165,43,n Kert,143,36,m Killu,164,49,n Kristi,155,53,n Kristiina,158,62,n Kristjan,164,59,m Lauri,156,53,m Madis,156,65,m Madis,165,53,m Maria,143,38,n Mart,170,69,m Marta,169,550,n Martin,159,46,m Mati,160,72,m Mati,163,60,m Mihkel,165,69,m Miia,145,68,n Moonika,164,58,n Priit,156,63,m Siim,151,38,m Siim,151,55,m Tiina,170,38,n [jaagup@lin2 uuring1]$ more 5klass.txt -n +2 | sort -n: No such file or directory +2: No such file or directory :::::::::::::: :::::::::::::: 5klass.txt eesnimi,pikkus,mass,sugu Gert,152,67,m Jaan,162,65,m Jaanika,165,59,n Jaanus,164,63,m Juhan,175,110,m Juku,170,45,m Kadri,164,57,n Katariina,148,35,n Kati,160,35,n Katrin,165,43,n Kert,143,36,m Killu,164,49,n Kristi,155,53,n Kristiina,158,62,n Kristjan,164,59,m Lauri,156,53,m Madis,156,65,m Madis,165,53,m Maria,143,38,n Mart,170,69,m Marta,169,550,n Martin,159,46,m Mati,160,72,m Mati,163,60,m Mihkel,165,69,m Miia,145,68,n Moonika,164,58,n Priit,156,63,m Siim,151,38,m Siim,151,55,m Tiina,170,38,n [jaagup@lin2 uuring1]$ more 5klass.txt | tail -n +2 | sort Gert,152,67,m Jaan,162,65,m Jaanika,165,59,n Jaanus,164,63,m Juhan,175,110,m Juku,170,45,m Kadri,164,57,n Katariina,148,35,n Kati,160,35,n Katrin,165,43,n Kert,143,36,m Killu,164,49,n Kristi,155,53,n Kristiina,158,62,n Kristjan,164,59,m Lauri,156,53,m Madis,156,65,m Madis,165,53,m Maria,143,38,n Mart,170,69,m Marta,169,550,n Martin,159,46,m Mati,160,72,m Mati,163,60,m Mihkel,165,69,m Miia,145,68,n Moonika,164,58,n Priit,156,63,m Siim,151,38,m Siim,151,55,m Tiina,170,38,n [jaagup@lin2 uuring1]$ more 5klass.txt | tail -n +2 | grep at Kati,160,35,n Mati,160,72,m Mati,163,60,m Katrin,165,43,n Katariina,148,35,n [jaagup@lin2 uuring1]$ grep at * 5klass.txt:Kati,160,35,n 5klass.txt:Mati,160,72,m 5klass.txt:Mati,163,60,m 5klass.txt:Katrin,165,43,n 5klass.txt:Katariina,148,35,n eesnimed2.txt:Kati eesnimed2.txt:Mati eesnimed.txt:Kati eesnimed.txt:Mati kaisuklass.txt:Kati,160,35,n kaisuklass.txt:Mati,160,72,m kaisuklass.txt:Mati,163,60,m kaisuklass.txt:Katrin,165,43,n kaisuklass.txt:Katariina,148,35,n kaisuklass.txt~:Kati,160,35,n kaisuklass.txt~:Mati,160,72,m kaisuklass.txt~:Mati,163,60,m kaisuklass.txt~:Katrin,165,43,n kaisuklass.txt~:Katariina,148,35,n klass2.txt:Kati,150,45,n klass2.txt:Mati,180,85,m klass2.txt~:Kati,150,45,n klass2.txt~:Mati,180,85,m ylevaade1.sh:tail 5klass.txt -n +2 | sort --field-separator="," -k 2 -n -r | head -n 1 >> vastus.txt ylevaade1.sh:tail 5klass.txt -n +2 | sort --field-separator="," -k 2 -n | head -n 1 >> vastus.txt [jaagup@lin2 uuring1]$ more 5klass.txt | tail -n +2 | cut -- [jaagup@lin2 uuring1]$ more 5klass.txt | cut --delimiter="," -f 1,3 eesnimi,mass Juku,45 Kati,35 Mati,72 Madis,53 Mati,60 Katrin,43 Siim,38 Martin,46 Kadri,57 Katariina,35 Maria,38 Marta,550 Madis,65 Mihkel,69 Tiina,38 Miia,68 Siim,55 Juhan,110 Priit,63 Kristjan,59 Kristi,53 Kristiina,62 Killu,49 Mart,69 Kert,36 Gert,67 Lauri,53 Moonika,58 Jaanika,59 Jaanus,63 Jaan,65 [jaagup@lin2 uuring1]$ more 5klass.txt | cut --delimiter="," -f 1,4 eesnimi,sugu Juku,m Kati,n Mati,m Madis,m Mati,m Katrin,n Siim,m Martin,m Kadri,n Katariina,n Maria,n Marta,n Madis,m Mihkel,m Tiina,n Miia,n Siim,m Juhan,m Priit,m Kristjan,m Kristi,n Kristiina,n Killu,n Mart,m Kert,m Gert,m Lauri,m Moonika,n Jaanika,n Jaanus,m Jaan,m [jaagup@lin2 uuring1]$ more 5klass.txt | cut --delimiter="," -f 1,4 > vastus2.txt [jaagup@lin2 uuring1]$ more vastus2.txt eesnimi,sugu Juku,m Kati,n Mati,m Madis,m Mati,m Katrin,n Siim,m Martin,m Kadri,n Katariina,n Maria,n Marta,n Madis,m Mihkel,m Tiina,n Miia,n Siim,m Juhan,m Priit,m Kristjan,m Kristi,n Kristiina,n Killu,n Mart,m Kert,m Gert,m Lauri,m Moonika,n Jaanika,n Jaanus,m Jaan,m [jaagup@lin2 uuring1]$ more 5klass.txt | sort --field-separator="," -k 2,2 Kert,143,36,m Maria,143,38,n Miia,145,68,n Katariina,148,35,n Siim,151,38,m Siim,151,55,m Gert,152,67,m Kristi,155,53,n Lauri,156,53,m Madis,156,65,m Priit,156,63,m Kristiina,158,62,n Martin,159,46,m Kati,160,35,n Mati,160,72,m Jaan,162,65,m Mati,163,60,m Jaanus,164,63,m Kadri,164,57,n Killu,164,49,n Kristjan,164,59,m Moonika,164,58,n Jaanika,165,59,n Katrin,165,43,n Madis,165,53,m Mihkel,165,69,m Marta,169,550,n Juku,170,45,m Mart,170,69,m Tiina,170,38,n Juhan,175,110,m eesnimi,pikkus,mass,sugu [jaagup@lin2 uuring1]$ more 5klass.txt | sort --field-separator="," -k 2,2 -r eesnimi,pikkus,mass,sugu Juhan,175,110,m Tiina,170,38,n Mart,170,69,m Juku,170,45,m Marta,169,550,n Mihkel,165,69,m Madis,165,53,m Katrin,165,43,n Jaanika,165,59,n Moonika,164,58,n Kristjan,164,59,m Killu,164,49,n Kadri,164,57,n Jaanus,164,63,m Mati,163,60,m Jaan,162,65,m Mati,160,72,m Kati,160,35,n Martin,159,46,m Kristiina,158,62,n Priit,156,63,m Madis,156,65,m Lauri,156,53,m Kristi,155,53,n Gert,152,67,m Siim,151,55,m Siim,151,38,m Katariina,148,35,n Miia,145,68,n Maria,143,38,n Kert,143,36,m [jaagup@lin2 uuring1]$ [jaagup@lin2 uuring1]$ python Python 2.3.4 (#1, Apr 15 2011, 17:40:06) [GCC 3.4.6 20060404 (Red Hat 3.4.6-11)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import re >>> re.search("tere", "juku ytles tere mulle") <_sre.SRE_Match object at 0xb7ef4170> >>> if re.search("tere", "juku ytles tere mulle"): print "leiti" ... leiti >>> if re.search("tere", "juku ytles ei mulle"): print "leiti" ... >>> re.match("[0-9]{3}[a-z]{3}", "paistis 334ggh masin") >>> re.match("[0-9]{3}[a-z]{3}", "paistis 334gg masin") >>> re.findall("[0-9]{3}[a-z]{3}", "paistis 334gg masin") [] >>> re.findall("[0-9]{3}[a-z]{3}", "paistis 334gga masin") ['334gga'] >>> re.findall("[0-9]{3}[a-z]{3}", "paistis 334gga ning 445aab masin") ['334gga', '445aab'] >>> re.match(".*[0-9]{3}[a-z]{3}.*", "paistis 334gg masin") >>> re.findall("[0-9]{3}[a-z]{3}", "paistis 334gga ning 445aab masin") ['334gga', '445aab'] >>> re.sub("[0-9]{3}[a-z]{3}", "autonumber", "paistis 334gga ning 445aab masin") 'paistis autonumber ning autonumber masin' >>> re.sub("([0-9]{3})([a-z]{3})", "\\2 \\1", "paistis 334gga ning 445aab masin") 'paistis gga 334 ning aab 445 masin' >>> [jaagup@lin2 uuring1]$ ssh praktika1.cs.tlu.ee jaagup@praktika1.cs.tlu.ee's password: Welcome to Linux Mint 18 Sarah (GNU/Linux 4.4.0-21-generic x86_64) * Documentation: https://www.linuxmint.com Last login: Fri Dec 8 12:14:56 2017 from 193.40.238.41 jaagup@praktika1 ~ $ python3.5 Python 3.5.1+ (default, Mar 30 2016, 22:46:26) [GCC 5.3.1 20160330] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import pandas as pd >>> lapsed=pd.read_csv("http://www.tlu.ee/~jaagup/andmed/muu/5klass.txt") >>> lapsed.head() eesnimi pikkus mass sugu 0 Juku 170 45 m 1 Kati 160 35 n 2 Mati 160 72 m 3 Madis 165 53 m 4 Mati 163 60 m >>> lapsed.merge(lapsed, left_on="eesnimi", right_on="eesnimi") eesnimi pikkus_x mass_x sugu_x pikkus_y mass_y sugu_y 0 Juku 170 45 m 170 45 m 1 Kati 160 35 n 160 35 n 2 Mati 160 72 m 160 72 m 3 Mati 160 72 m 163 60 m 4 Mati 163 60 m 160 72 m 5 Mati 163 60 m 163 60 m 6 Madis 165 53 m 165 53 m 7 Madis 165 53 m 156 65 m 8 Madis 156 65 m 165 53 m 9 Madis 156 65 m 156 65 m 10 Katrin 165 43 n 165 43 n 11 Siim 141 38 m 141 38 m 12 Siim 141 38 m 151 55 m 13 Siim 151 55 m 141 38 m 14 Siim 151 55 m 151 55 m 15 Martin 159 46 m 159 46 m 16 Kadri 164 57 n 164 57 n 17 Katariina 148 35 n 148 35 n 18 Maria 143 38 n 143 38 n 19 Marta 169 55 n 169 55 n 20 Mihkel 165 69 m 165 69 m 21 Tiina 170 38 n 170 38 n 22 Miia 145 68 n 145 68 n 23 Priit 156 63 m 156 63 m 24 Kristjan 164 59 m 164 59 m 25 Kristi 155 53 n 155 53 n 26 Kristiina 158 62 n 158 62 n 27 Killu 164 49 n 164 49 n 28 Mart 170 69 m 170 69 m 29 Kert 143 36 m 143 36 m 30 Gert 152 67 m 152 67 m 31 Lauri 156 53 m 156 53 m 32 Moonika 164 58 n 164 58 n 33 Jaanika 165 59 n 165 59 n 34 Jaanus 164 63 m 164 63 m 35 Jaan 162 65 m 162 65 m >>> lapsed.pikkus.min() 141 >>> lapsed.pikkus.max() 170 >>> lapsed.pikkus.mean() 158.90000000000001 >>> lapsed.pikkus.median() 161.0 >>> lapsed.pikkus.std() 8.4459743522355488 >>> for enimi in lapsed[lapsed.pikkus>lapsed.pikkus.mean()].eesnimi.values:print enimi File "", line 1 for enimi in lapsed[lapsed.pikkus>lapsed.pikkus.mean()].eesnimi.values:print enimi ^ SyntaxError: invalid syntax >>> for enimi in lapsed[lapsed.pikkus>lapsed.pikkus.mean()].eesnimi.values: ... print(enimi) ... Juku Kati Mati Madis Mati Katrin Martin Kadri Marta Mihkel Tiina Kristjan Killu Mart Moonika Jaanika Jaanus Jaan >>> lapsed[lapsed.pikkus>lapsed.pikkus.mean()].eesnimi.values array(['Juku', 'Kati', 'Mati', 'Madis', 'Mati', 'Katrin', 'Martin', 'Kadri', 'Marta', 'Mihkel', 'Tiina', 'Kristjan', 'Killu', 'Mart', 'Moonika', 'Jaanika', 'Jaanus', 'Jaan'], dtype=object) >>> list(lapsed[lapsed.pikkus>lapsed.pikkus.mean()].eesnimi.values) ['Juku', 'Kati', 'Mati', 'Madis', 'Mati', 'Katrin', 'Martin', 'Kadri', 'Marta', 'Mihkel', 'Tiina', 'Kristjan', 'Killu', 'Mart', 'Moonika', 'Jaanika', 'Jaanus', 'Jaan'] >>> lapsed.groupby("sugu").pikkus.mean() sugu m 158.647059 n 159.230769 Name: pikkus, dtype: float64 >>> jaagup@praktika1 ~ $ mysql -umart -pajutine1234 mart Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 5976 Server version: 10.0.24-MariaDB-7 Ubuntu 16.04 Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [mart]> show tables; +------------------------------------+ | Tables_in_mart | +------------------------------------+ | dh_anastasia_filmivaatajad | | dh_anastasia_filmivaatamised | | dh_anastasia_filmivaatamised1 | | dh_anastasia_filmivaatamised2 | | dh_anastasia_kylalised | | dh_anastasia_lemmikautor | | dh_anastasia_mangufilmid | | dh_anastasia_visitors | | dh_annika_dokfilmid | | dh_annika_filmivaatajad | | dh_annika_filmivaatamised | | dh_annika_hobid | | dh_annika_inimesed | | dh_annika_mangufilmid | | dh_astrid_animafilmid | | dh_astrid_filmihindajad | | dh_astrid_filmivaatajad | | dh_astrid_filmivaatamised | | dh_astrid_inimesed | | dh_astrid_mangufilmid | | dh_gat_filmid | | dh_gat_filmivaatajad | | dh_gatlin_filmivaatajad | | dh_hagi_dok | | dh_hagi_dokumentaalfilmid | | dh_hagi_filmivaatajad | | dh_hagi_filmivaatamised | | dh_hagi_mangufilmid | | dh_jaagup_filmivaatajad | | dh_jaagup_filmivaatamised | | dh_jaagup_mangufilmid | | dh_kairi__naitlejad2 | | dh_kairi_animafilmid | | dh_kairi_film | | dh_kairi_filmid | | dh_kairi_filmid1 | | dh_kairi_filmivaatajad | | dh_kairi_homealone | | dh_kairi_homealone1 | | dh_kairi_mangufilmid | | dh_kairi_naitlejad | | dh_kairi_naitlejad1 | | dh_kairi_uksindakodus | | dh_kaisa_filmivaatajad | | dh_kaisa_filmivaatamised | | dh_kaisa_kinod | | dh_kaisa_mangufilmid | | dh_kaisa_noortefilmid | | dh_katarina_armastusfilmid | | dh_katarina_elanikud | | dh_katarina_filminaitlejad | | dh_katarina_filmivaatajad | | dh_katarina_filmivaatamised | | dh_katarina_mangufilmid | | dh_kristina_filmid | | dh_kristina_filmivaatajad | | dh_kristina_filmivaatamised | | dh_kristina_kliendid | | dh_kristina_kylastamised | | dh_kristina_mangufilmid | | dh_liisi_film | | dh_liisi_filmivaatajad | | dh_liisi_filmivaatamised | | dh_liisi_inimesed | | dh_liisi_kliendid | | dh_liisi_külastajad | | dh_liisi_mängufilmid | | dh_liisi_põnevusfilmid | | dh_sandra_filmivaatajad | | dh_sandra_filmivaatamised | | dh_sandra_lavastajad | | dh_sandra_lavastjad | | dh_sandra_mangufilmid | | dh_sandra_põnevusfilmid | | efis_company | | efis_company_description | | efis_company_image | | efis_email_templates | | efis_festival | | efis_festival_translation | | efis_film | | efis_film_archive_location | | efis_film_change_log | | efis_film_copyright | | efis_film_country | | efis_film_distributor | | efis_film_edition | | efis_film_festival | | efis_film_gallery | | efis_film_gallery_file | | efis_film_gallery_file_translation | | efis_film_gallery_translation | | efis_film_keyword | | efis_film_maker | | efis_film_media_publication | | efis_film_media_publication_file | | efis_film_music | | efis_film_music_maker | | efis_film_physical_description | | efis_film_production | | efis_film_purchase | | efis_film_quote | | efis_film_relation | | efis_film_role_person | | efis_film_scenario_file | | efis_film_screening | | efis_film_screening_result | | efis_film_section | | efis_film_seq | | efis_film_sound_clip | | efis_film_title_episode | | efis_film_title_parallel | | efis_film_track | | efis_film_translation | | efis_film_type | | efis_film_type_rel | | efis_film_type_rel_veebist | | efis_film_type_translation | | efis_film_video | | efis_keyword | | efis_keyword_group | | efis_keyword_group_translation | | efis_keyword_keyword_group | | efis_keyword_translation | | efis_message_receivers | | efis_message_thread_receivers | | efis_message_threads | | efis_messages | | efis_messages_rel} | | efis_people | | efis_people_description | | efis_people_image | | efis_people_image_translation | | efis_task | | efis_task_file | | efis_task_person | +------------------------------------+ 136 rows in set (0.01 sec) MariaDB [mart]> MariaDB [mart]> CREATE TABLE dh_jaagup_sonad( -> sona VARCHAR(50) NOT NULL PRIMARY KEY, -> lemma VARCHAR(50) NOT NULL -> ); Query OK, 0 rows affected (0.01 sec) MariaDB [mart]> MariaDB [mart]> INSERT INTO dh_jaagup_sonad VALUES ('hakkame', 'hakkama'); Query OK, 1 row affected (0.01 sec) MariaDB [mart]> INSERT INTO dh_jaagup_sonad VALUES ('kirjutama', 'kirjutama'); Query OK, 1 row affected (0.00 sec) MariaDB [mart]> SELECT * FROM dh_jaagup_sonad; +-----------+-----------+ | sona | lemma | +-----------+-----------+ | hakkame | hakkama | | kirjutama | kirjutama | +-----------+-----------+ 2 rows in set (0.00 sec) MariaDB [mart]> SELECT * FROM dh_jaagup_sonad ORDER BY sona DESC; +-----------+-----------+ | sona | lemma | +-----------+-----------+ | kirjutama | kirjutama | | hakkame | hakkama | +-----------+-----------+ 2 rows in set (0.00 sec) MariaDB [mart]> SELECT * FROM dh_jaagup_sonad WHERE sona LIKE 'k%'; +-----------+-----------+ | sona | lemma | +-----------+-----------+ | kirjutama | kirjutama | +-----------+-----------+ 1 row in set (0.00 sec) MariaDB [mart]> SELECT LENGTH(sona) FROM dh_jaagup_sonad; +--------------+ | LENGTH(sona) | +--------------+ | 7 | | 9 | +--------------+ 2 rows in set (0.00 sec) MariaDB [mart]> ALTER TABLE dh_jaagup_sonad ADD sonapikkus INT; Query OK, 0 rows affected (0.05 sec) Records: 0 Duplicates: 0 Warnings: 0 MariaDB [mart]> SELECT * FROM dh_jaagup_sonad; +-----------+-----------+------------+ | sona | lemma | sonapikkus | +-----------+-----------+------------+ | hakkame | hakkama | NULL | | kirjutama | kirjutama | NULL | +-----------+-----------+------------+ 2 rows in set (0.00 sec) MariaDB [mart]> MariaDB [mart]> UPDATE dh_jaagup_sonad SET sonapikkus=LENGTH(sona); Query OK, 2 rows affected (0.00 sec) Rows matched: 2 Changed: 2 Warnings: 0 MariaDB [mart]> SELECT * FROM dh_jaagup_sonad; +-----------+-----------+------------+ | sona | lemma | sonapikkus | +-----------+-----------+------------+ | hakkame | hakkama | 7 | | kirjutama | kirjutama | 9 | +-----------+-----------+------------+ 2 rows in set (0.00 sec) MariaDB [mart]>