1 00:00:06,070 --> 00:00:07,480 Hi, welcome back. 2 00:00:08,170 --> 00:00:16,780 In this video, you will learn how to use Python to save the important data from the script data from 3 00:00:16,780 --> 00:00:23,470 our website as a table and a database and query that table. 4 00:00:23,500 --> 00:00:24,850 So let's begin. 5 00:00:25,960 --> 00:00:33,580 First step is to open the vision admin for user interface and create a new database called Programming 6 00:00:33,580 --> 00:00:42,730 as a click on the servers dropdown, then possibly dropdown, then choose, create, then choose a database. 7 00:00:42,730 --> 00:00:54,370 Then in general tab we add our database name and programming, then in definition tab and for template 8 00:00:54,520 --> 00:01:01,960 we will choose 10 zeros, then click save to save database we have just created right. 9 00:01:01,960 --> 00:01:04,960 Click on database and choose refresh. 10 00:01:05,080 --> 00:01:08,140 This will activate our new database programming. 11 00:01:08,140 --> 00:01:17,290 Now we will open our ACMD and Windows or terminal in Mac OS to run and jump in our lab at the following 12 00:01:17,570 --> 00:01:20,950 Jobster Space Lab and enter. 13 00:01:21,370 --> 00:01:29,590 This will open our job at our lab as the following and the first cell as we learn before we will import 14 00:01:29,590 --> 00:01:35,140 our python module that we will use in our project as the following. 15 00:01:35,380 --> 00:01:45,010 Import psychobilly to as Biju, to then import Banda's as b'day in the second line and run the cell. 16 00:01:45,490 --> 00:01:55,930 Then we will assign that variable to data that Banda's will read from HTML five of the specified Web 17 00:01:55,930 --> 00:02:00,650 page in the HTML read method of the painter's module. 18 00:02:01,000 --> 00:02:09,760 As we said before, the panda's return data and the XML file of the web page as Python lists. 19 00:02:10,000 --> 00:02:18,040 So we will choose the important information of this data and assign it to a data frame called D.F., 20 00:02:18,040 --> 00:02:26,020 for example, as the following def equal data between two square brackets zero. 21 00:02:26,350 --> 00:02:34,710 Then we will print this D.F. data frame by typing D.F. NSL, then run that cell. 22 00:02:35,230 --> 00:02:42,430 We observe that there are columns, names needed to be cleaned, so we will use the name method as the 23 00:02:42,430 --> 00:02:50,560 following to clean those columns names and make it easy for Python to save it as columns in a table 24 00:02:50,560 --> 00:02:54,670 in the database programming we have just created. 25 00:02:54,680 --> 00:03:03,370 So our code will be as the following def equals def Dautry name between two brackets column equal between 26 00:03:03,370 --> 00:03:05,080 to carry brackets. 27 00:03:05,620 --> 00:03:13,330 The names of the columns that we want to rename as the following between two parentheses popularity 28 00:03:13,570 --> 00:03:23,650 unique visitors per month one column then between two parentheses the new name we want to rename our 29 00:03:23,650 --> 00:03:28,630 column Enter and so on for the other columns we want to rename. 30 00:03:28,630 --> 00:03:37,880 You can also rename the Our Case column into lowercase column, but it is not important because PostgreSQL 31 00:03:37,890 --> 00:03:38,950 Equal is not the case. 32 00:03:38,950 --> 00:03:41,980 Since then, we will declare our connection. 33 00:03:42,220 --> 00:03:55,240 So assign können variable equal bije dot connect and between two brackets the host is localhost between 34 00:03:55,240 --> 00:04:01,900 two double parentheses and support my board. 35 00:04:02,440 --> 00:04:10,090 That name programming between two double parenthesis and use are between two entities, in my case both 36 00:04:10,090 --> 00:04:22,480 degrees and my best words between two double parentheses and so on the run zisser to make the connection. 37 00:04:22,660 --> 00:04:31,810 Then we will import important module for our project as the following from Esequiel Alchemy Import Create. 38 00:04:31,810 --> 00:04:41,230 And so we will use create engine from execute alchemy module to create our new table called Babbler 39 00:04:41,230 --> 00:04:48,140 Language as the following engine Ekwall create engine between two brackets and two parentheses both 40 00:04:48,140 --> 00:04:52,360 degrees equal plus psychobilly two column. 41 00:04:54,030 --> 00:05:03,570 Slash, slash, possibly then column, then my password at localhost, then Collum, then my budget 42 00:05:03,600 --> 00:05:12,780 slash programming, then closes apprentice's and close the brackets, then a new line. 43 00:05:13,380 --> 00:05:15,810 We want to save the table. 44 00:05:15,810 --> 00:05:24,620 We have just created to our database programming as the following, using data frame dot to sexual order 45 00:05:24,730 --> 00:05:26,900 to ask you all method. 46 00:05:27,030 --> 00:05:35,880 So the f dot to underscore Ezekial between two brackets and two parentheses. 47 00:05:36,090 --> 00:05:46,680 The first item Babulal underscore language comma engine comma f exist equal append comma and X equal 48 00:05:46,680 --> 00:05:47,170 fold. 49 00:05:47,190 --> 00:05:57,660 So our table babbler underscore language will be created by Engin which will search if exists and created 50 00:05:58,020 --> 00:06:00,780 by Eskil Alchemy. 51 00:06:01,320 --> 00:06:09,660 And we don't need to add and next to our new table babbler underscore language and run the self. 52 00:06:10,470 --> 00:06:20,130 At this moment we were written to be admin for to check our database programming and our new table created 53 00:06:20,130 --> 00:06:22,200 as the following. 54 00:06:22,890 --> 00:06:32,340 We will refresh database dropdown, then Orbin programming database, then a scheme, then public, 55 00:06:32,640 --> 00:06:34,440 then tables. 56 00:06:34,590 --> 00:06:39,150 So we will find the new table babbler underscore language. 57 00:06:39,330 --> 00:06:50,250 Now we will queries a new table as the following select abstracts from Babulal underscore language, 58 00:06:50,430 --> 00:06:59,790 then run the query and return in six columns and thirteen rows which affected by our query and the same 59 00:06:59,790 --> 00:07:03,450 data in our data frame will be return it. 60 00:07:04,170 --> 00:07:07,690 At this point we reach the end of this lecture. 61 00:07:07,710 --> 00:07:10,370 Hope you enjoyed this lecture and get all of that. 62 00:07:10,710 --> 00:07:11,910 Thanks for being here. 63 00:07:13,470 --> 00:07:14,640 Thanks for watching. 64 00:07:14,790 --> 00:07:16,580 See you next with you.