Transcripts
1. Introduction: Hey, very pretty WhatsApp and the Satori away. We will introduce the new program, which we will work on on the risk off this course for our cooling. So this program is called Anaconda, and it's a very great and pick platform for programming and especially for Python programming. So at first we will learn how to download this program so you can search on Google Web download Anaconda and then from the results, we will press on Python Anaconda Cloud. So from this window we will get to download Anaconda. So here from this website, which as the anaconda, you can download the Anaconda software so you can know spelt we have a version for the Windows and one for the Mac OS and another one for the Lennox. So according to the operating system which he works on, you can download the software which will fetch your operating system. So also we have two versions and each operating system. So when we get to Windows, for example, we will have a version which have the latest one, which has 3.6 and another version for Python 2.7. So we will download or we recommend to download the python 3.6. It have more futures and it's also being used. So it also has two versions one for the Windows 32 pit and one for the windows 64 pic. So we will press on download and here it asked to see you for the path at which you want to save your fuller. So we will press save now and the downloading is running now. But we will close it as I have downloaded it and you will continue downloading it. And after finishing we downloading, you can go totally pap at what you have saved your file. So this is our file after downloading it and it's a zip file so we can extract at here. And after extracting at, we're ready now to in a soul, our program so we can have a double clicking at two and stole it. So after this, you can press next and I agree and next. So it asks you for Lee path at which he wants to in a stole your program. So this is the the full path, and I recommend you to install it and leading full pass thoughts. You can change it as you want. And after this you can press next. But as I have in a solely program, exactly, I'll cancel at popped. You won't continually installation process, and it's a very easy and systematic soil Press. Cancel part You will continue at. So your purse? Yes. And after finishing the installation, you will find that this is the I couldn't Fort Lee proved him, which will appear into your desktop soil present at two up him the program. So this is the initial window, which will appear to you for the program. So as I told you, it's a very useful program as it collects many platforms insight at. So you can use the governor lab and job, Internet Park and Kitty Council and spider and so on. But for this course, we will work on the Jupiter Napoca. So for this week, impress on launch to enter use this software. So this is the window of the Jupiter notebook and these are the files so support that you want now to get a new project or and you killing fine. So we will press on you and then python three. So at this python 35 we can start writing our coot and some lines of it. So this is eso at which we can write another line of code. So let's, for example, start with print in Hillah Warlick. So for running this line of good, we can press, shift and enter. So pi pressing shift and enter, we can run our cell or our line of code. So you cannot see that on the output we have the hello world it here on the output and you cannot see death after running this. So we have here another soul which appears to us so we can write anything which we want or in the line of code which we want into this cell. And also we can type another lines of good until this silk by pressing an answer. So pi pressing an answer. We have any number off lines which we want. So, for example, here let's type X equal three and then x and execute this line. So you cannot say that after pressing shift and enter, we have the output, which eh? Three. After Hello, Worley, as we have here, Type X and also we can't sign anything into this soul. So support Beth. We wanted to type wide, equal to and then answer. And then why? So when we press shift and enter, we can execute this line or these two lines of good which has inside this so so the output here as too. But here we have executed each line separately. So we run this line. And after this, we're on this life. But support now that we want to run all the lines off this project so we can press easily on so and then your run old soap, I pressing on run all we can run all the lines off our fire. So for this lets you change this another one for five, for example. And let's a change it or this one. Where's your sex, for example? And go again to so and then run old. So you can know that we have run all the lines as here. This six has being changed here to sex, as we have change it at. And this five also has being change it to five until the out. And also you can insert at so between two cells by going to insert and then insert at. So hello So pi inserting here a soap. Hello. We have inserted as so between this line and this life. And also we can go toe this line again and press on insert and then insert celeb pop. So we have your inserted eso a pop this one. And for this we can type for some full see equal here seven and then see and go to sell and we can hear run solo pop We can run the currency and old the cells a puppet And if we press on run Opel we can run this ill and hold these souls which, as pill at soap I pressing run old puff We can know today this line here is executed and also this line as executed. But here let's tithe another line into this silk which, as, for example, f equal 100 then f and let's go toe this line again and press on soul and run old Hello. So for this we can run best line of code or this so and each lines pillow it so we can press on run, old fellow so you can notice the death This line has bean executed and hold the Alliance pillow. It also has been executed. So this was a quick overview on the Jupiter notebook Python files, and how can we handle at As in the next lectures, we will dive deeply into it, as we will use it until the rest off this course and learn more and more off our data and else's course. So this is upheld this very fast tutorial. Hope it's clear for you. Thank you for watching and see you next tutorials.
2. Creating Series: Hey, everybody, what's up? And the security of we will learn with each other different way is off, creating the serious object in pianist. So at first we must importantly pendants like pretty so we can write imports. The end does as PD. So this is for using the pandas tools in our coot And then we can press, shift and enter to run this line of good. So let's now go to the first way off creating the serious object which as pie passing as killer value. So we will write s one and this is our serious object And we will write, be the dot Siri's and let's now right the valley off at which maybe 10 for example. And after this we will write s one and we will write, shift and enter So we cannot stand this as the default index which our program have automatically made as we haven't dismiss if I it and end ICS and this is the value which we have entered and also this is an injured value. But what about if we want to enter a string value so we can do this by right as straying inside a single quotation so we can write A for example. So this is s ring. And after this we can write, shift and enter so we can know Step, This is our string, which we have made. So this is upheld the first way off creating the serious object pie passing as killer value . And now let's go to the second way, which is Pai Pai thing. AARP isil list through our serious object. So for doing this, we can write another serious object with s two equal PD duck serious in the round practice and square practice. So inside them we can write our values, which is 10 and 20 in three and 40 for example. So for running this line, we can write as to in shift and enter. So these are our values and we can notes that we have an automatically generated indices as we haven't specified the values off our indices. But we can't notice that these are our values here which has 10 25 30 and 40 Police are our values. All the data which we have entered. But what about if we want to specify the indices off our Sears so we can write another series and it will be name. And after this, it's equal pd dot Sears and Robert practice and then a square practice in the first name. Well, pee smells. So this is our first value. And the second value is Joan. And the 3rd 1 is Miller. So we can now write our indices by writing index equal and a square practice and is until this is our first index and then Jay and then I m So these are our indices here, and these are from the strength type. So this is SJ in M and these are our values and these are also from the strength type. So we can't now try this good pot. At first we can write name and we can ride, shift and enter. And we can't find that these are our indices, which we have a specified inst ead off these default indices. So as for Smith and J for Joanie and M for Miller. So this is the way off creating the embassies after Carrie etting our values or our data and never let's go toe the third way off creating the serious object which, as Pai Pai thing, a python dictionary to our serious object. So for doing this we can write a new series object, which is name to and named to equal Beattie, DUP, Sears and at Rahman Packet. And after this at curly brackets and we will ride the index which as s and the colon and the date of value, which as Suzanne, for example, and let's go to the second value, which have an index with Jay and a colon and J is for Jack. So this is the value, and the 3rd 1 is m. So this is the index, and it will be for Mike. It's of Michael Levy. Did A and we can write a curly bracket in the rally in practice. And now we can write name to for displaying the values of this serious object and then press shift and enter. So these are our values here, Jack, Michael and Suzanne. And these are the values or the indices off them. So this is the third ways, and we can note that the program have arrange it. These values occurred in tow, the alphabet. So we have J the first in after death M. And after this s although we have written the values on this sequence. The program have arranged them according to the alphabet. So we have J N M N s. So this is the difference between these or this arrangement which we have Britain and this arrangement. So this is for our tutorial today. Thank you for watching and see you next to Tories.
3. Information about series: Hey, everybody, what's up? And the security of will learn with each other, have to get some information and details of help. The serious so supposed that you have a serious and you want to know its lens or, in other words, the number off items. But unfortunately it's a very long serious, which means there you can't deter minus length manually or by observation, whether your eyes. So let's now try to do it simply. At first we have to define Lee pandas and non pie libraries for accessing their tools. We type import pandas as BD and also import numb pie as NP and shift and enter. And there we will write a series which represents the number off views off a YouTube video all the week, and we will construct the series Pai Pai thing a Paice a list. So let's now stir are serious by writing views equal pd dot serious and a rollin packets in a square bracket. In our data will P 100 and 600 and 250 in 303 101 100 we lost one will p. N p dot net. So these are the number off used at each day of the week and the nan value mean their best possession or the lost. They have no value as it's a mess there. So this one here is not a zero value part. It's MSD era and for accessing in and value, we need to use the num pie prefects. So this is the reason for which we have to import the num pie library. So we have important here the num pie light party as we need this prefects off the NP to access Li Nan value. And that's a piece of cake for now and we won't take it helped banana and death later and we will ride the serious name views to access ETS and we will press, shift and enter. So these are our values here for our sets or for our serious and these are the default and the seas off our Sears. So for getting billions off our serious we will, right, Len and round practice and views. So we have written this and the serious name inside these practice so this land will deter , mined or will access the length off our series and shift and enter. So the length here for our serious as seven and we have another way for doing that is pi writing views duck shape and shift and enter. So this is the second type by which we can get the lens off our series. But if these two ways annoys you, you can't use another one which has views, dealt size and shift and enter. So this is the third way of getting the length off our series. But what about if you need to get the length off? None and values at the previous three ways? We're forgetting the number off hold values so easily We can tie views, don't count and round, practice, shift and enter. So these are the nun Nan values inside our serious we can find them here. These are sex Onley without being and value. And now what if you want to detect the unique values inside your data But what we mean we have the unique values, so it's to get the old the values off. You're serious, but without its protection. So when we go to our serious, we won't find that we have here 106 102 150 parts. We will find that be repeated. Value is here 303 100 considered that the repeated values is on Lee one value. So if we want to get the unique values, we will find that here this 100 and 602 153 100 this 1000 and this nan value so that's repeated value has been canceled. So to do that, we will write views don't unique and Rowan practice in a shift in NZ. So these are our unique values here, 106 100 so on so we can find that the 300 hasn't been repeated as we walk now to get the unique values on Lee. So we have also another way to hit what we want by writing views don't value underscore Callens and round practice here we have also these are the unique values. But I prefer this method as it tell you the number off repetition off any value. So here we have 300 it's repeated two times, and here we have this 1000 and it's only repeated one time. So this is a better way forgetting the unique values. So in this lecture we have learned in three ways of getting the lens off our serious and two way is off getting the unique values. OK, that's for destitute aerial. About getting some information related to your serious object. Thank you for watching and see you next tutorials.
4. Peeking at data: Hey, buddy, buddy, what's up in the security? And we will continue handling with the serious object. Firstly, as the convention, we have imported bandits and non pie lifers, and we will use the same serious object off the previous tutorial part with defining new and X two at an esteemed off the automatically one as it can make more sense. So let's Taipower Siri's views equal BD dot serious round crack it in square bracket and 100 one or 600 253 100 301,000 and the last one for NP Dutton in and let's go to the end XO Index equal Saturday. But before it, we have to write a square bracket and Saturday in Sunday, Monday, Tuesday, when it's day, Thursday in the last one is Friday. So right views shift and enter. So these are our data, and these are the new and the seas, which we have entered. So that's good. And let sister at first. If we want to access the index for this, we will type and the line of code will P views antics. So these are our indices or this at the index off our series in which he has Saturday, Sunday, Monday and so on. And then if you want to do the n verse off this operation, which as to retrieve all the Siri's values. So for this we can write the line of code will be views dealt values. So these are the values off our series or leader cells and the last one for retrieving the indices. And we managed to view all elements off the Siri's. But what about if we want to view us? Lies off its rose, for example, three rose for rose. Plop, plop, plop easily We can tie and our order will be views head in the round, crack it and to inside it. So these our 1st 2 rows the Saturday and the Sunday and it's corresponding values off there . So this line of code will detect the 1st 2 rows and it can Pierrette and also pie views don't head and round packets inside at n equal to so. Also, we have managed to do the same part with another Centex, which, as in equal to we can notes also, if we haven't specified any value inside the around practice and left at empty, the output will be the 1st 5 froze as this is a standard off this lie pretty so we can do this. Pie writing views don't head and empty round packets. So this is, as we have mentioned, the 1st 5 rose as we haven't specified any value inside the practice. But what if we want to get the lost three rows, for example, as the previous weight was for accessing the rose, but from the 1st 1? So now we will do the same part by taking the lust rose as reference. And this will be by writing views. Duck tail three inside practice. So these are our lost three lines of code or our lust three rows as we have mentioned that we can use detail for accessing the values part from the last one, or by taking the last one as reference supposed. Now we want to retrieve a value off the Siri's, so we need to type views and square bracket inside at our value or our index, which may be sun, for example. So this is the 600 which had the value corresponding to the index off. Son in this had the jump index has to detect its corresponding value of dinner. And now we can also try this pie possession alone. And it's not be labeled one, as the previous method was pie accessing the label index, and now we can do the same pie, the positional and X by writing views square brackets in one inside at so the value also as 600 is This has its corresponding value and for accessing some specific value. That's what be Petr to write views, double square brackets and inside. It's Monday, for example, and Saturday. So here these are our values, and you must notes that we can't access deaths method by applying a label and Xcor possession of one. So for doing that, we can replace the Monday and Saturday with two and zero, so we can note that it will give us the same output as this as the same output as using this method. We can apply as we mentioned the label and export Lee possession what? But we have another method which is called the take method. But we can access at Pike using only the label index, Notley possession and what and using or for accessing the take method, we can ride views don't take in round packet in square brackets and 01 three, for example. And these are our values using the take method which can be accessed Onley using the possession allow index not the labeled one. So that's good to conclude what? We have learned it today. We can say that we have peaked at the data. Well, the head tail direct and take method. Okay, that's for this tutorial. Thank you for watching and see you next Tutorials.
5. Accessors(loc iloc ix): have any party. What's up in the sectorial? We will look closely at different ways for accessing the serious values with the index. Suppose now we have a serious with an index office drink type. Let's try it and then right string equal BD the serious around bracket and square bracket, for example, 50 60 70 and 80. And the index will be and X equal a the in si and the string. And this and the series with a string index, as you see. And you must be sure 100% there if you called any sale of the Dera using an injure value as an index. So so the program. What considered best injure as a possession of one, not a labelled one, and the reason easily is that the index type is a strength enough and injured. So when you call a value with an injured, there is no probability that the program can understand it as the labeled one because the index itself as a strength, as we have mentioned, and we can try it now. Pie typing strength one. And it appears here, 60 as into our series. But there may be more confusion if you can create a new serious with an injure and it's not a string one. So let's duet by typing Injure equal BD dot serious around pregnant square bracket. Maybe also 50 60 70 and they lost 1 80 pop. The index now will be index equal three to one and zero, and here that's clear. Now that the output index is an injured, then the pick question now debt Well, this engine represent Lee label or 12 represent the possession of value easily the answer it there. It's well represent Lee labeled Index Notley positional one. As the input and X is identical to that's we have entered to access the value and to prove that we will type enger and square practice and one so the output now will be 70. So that's amazing. We have proved what we want as 70 as corresponding to the third possession, not the 2nd 1 which means that the accessing operation is done. Pi delay pulling up by the possession. But to avoid the confusion with the surly choice label possession label possession, we can use more convenient and staple method which as to type and then injure dumb luck one . This is to get the value pie, the label index and the output here can p 70. So this l put is exactly for the third silk and we type also injure. Don't I look one to get the value by the possession of end ICS So sexy here is the output and the l put is exactly for the second silt, as we called it with the second possession. So we held the zero possession which as 50 and the 1st 1 sexy. The 2nd 1 is 70 and the 3rd 1 is 80 But we have access the 60 we which corresponds still these second possession. So by these methods we can't enforce the selection to people I the index labels using the luck access er or pipe the end X possessions using the I look xer But we can also access more than one value using the look and I look xers by typing injures don't look and double square brackets inside it one and two. So this is for the labels, regardless to the end exposition. But when we write injures, don't I look double square brackets one and two. We will find that the output appears occurred in tow. The possession regardless till the end X labels as 60 as the second possession and 70 as the 3rd 1 And then what if we passed? None exists Possessions till the luck access. Er I can hear you're saying that the program will give us an error part. This is wrong as the program. Well, tell us there the value corresponds. Still, dispossession is AnAnd value. So for trying best. Let's type Inger don't look in double square brackets and let's to try one in 50 and 40 so we can find the one have a corresponding value. However, the data with labels 50 and 40 not exist. So that's good right now and then we can say that there is an alter native access er intercede off the look and I look, which is cold i x so we can try it now on the strengths. Here's but before accessing the I X axis. Sir, we can't recall the string serious again pie writing strength. And for now, let's to try access the I X axis ERP I writing straying Don't I X inside at three as it works with the possession here we have access to the fourth possession and it works also with the late apple pie writing string, the I, X and D, so it gives the same value. But according to the label, and if you want to use the I X axis, Sir Webley Serious, which has injure and X, you will find that the priority will be for the label, the possession, then for clarification. Let's use the Enger Sears and we will recall it again. Pie enger and let's use the I X axis ERP I writing Enger, don't I? X Inside the brackets, we have the zero possession here. It's clear that the 80 corresponds to the lost label, which zero? Not the first possession. So we have proved that the priority will be for the label when you use the I X excerpt. But now we have a pig note and practical world of coding where we are handling a larger could. The best way is by using the look, and I look as they are more efficient for producing a Petr Kuyt. At the end, we can conclude that in this lecture we have discussed different methods for getting the serious values starting from the traditional way. Then they look and I look access. Er's lastly with the I X Exeter. Okay, that's for this tutorial. Thank you for watching and see you next Tutorials.
6. Arithmetic Operations: Hey, tea party. What's up in the sectorial? We will discuss how to apply charismatic operations on the serious object like addition, subtraction, division and so on. But before starting in, there is magic operation. We have to explain a very important prosperity in Panda's like three. This prosperity is called alignment, but what does a line than mean? So simply alignment means there when you are going to apply an operation via pandas Library its first align data based on index label value in a steed off simply applying the operation to the element which have the same possession. We will examine it using to serious objects. So let's define the 1st 1 and then right serious one equal de de dot serious and the values will be 50 60 70 and 80 and the index well p e if z and edge. So this is the serious one and we will write serious and execute it. So that's good. This as our serious here and this is its out and the pell the 2nd 1 We will tie serious too . Equal pd dot serious inside the brackets 20 30 40 and 50 and the index will be. It's you see if and eat So this is serious too, and we can write it and execute it. So this as our series and these are the index off it or this is its index and this is B did a So now we must know that I have a change in the arrangement of values and index and this Siri's to see what will happen. Okay, Now let's add them. So simply for adding to serious, we can write serious one plus Souness too. So here at the output H value as 100 off our data. But what has happened here? So Band has added each value to s corresponding value according to the label off the index milk be possession. So if we add them according to the possession, we will find that e will be added to etch and f will be added to G and G will be added to f and so on. Etch will be added to eat. But what have haven't in debt? The E has added to e here. So we have added 50 to 50 so it will be 100. And also the f has added to the F so we won't add 40 to 60. So Atwell p 100 so on for each labor. Vesa Great. So again, what Penders make behind the scenes firstly aligned the data bits on the end X labels. So E was e g with G and F was f an Etch was H and then applied the charismatic operation and note that the index and the result is arranging in ascending order. So e, f, g and H this becomes a powerful when using panda Siri's to combine their appears on labels and steed off having to order the data manually. At first, I think this definition needs more so to rent force this point we will create another example. So let's define a new series and it will be a serious three. Equal BD dealt serious and its values well p 10 and 20 30 and 50 and its index will be, for example, a P C and D. And let's run it So these are our l puts here a PCD and it's have 10 2030 and 50. That's good, and we will define another one also which has serious for and it will be equal. BD dot serious and its values will be 60 70 80 and 90 and its index will be he see de and eat in Let's run it. So this is our second series and we must notes that these two Siri's objects have Onley intersecting index labels at B C and the as the label exists on the series. Three. While it doesn't exist on the serious force and also the late really exists on serious for and it doesn't exist in Fear Street Okay, let's add them by writing serious re plus Sears for And this is the output so we can know step the value off a is AnAnd value and the value off he also as an n one. So let's lust rate what have happened, says Serious. Three has an A label and serious four dozen. The result is then likewise with serious four having an e label and serious. Three. Don't have the label or don't have this late with as the nan value is by the full. The result off any pandas charismatic operation where an end X label doesn't align with the other in the series. This nan value is common, as did assets used in many statistical financial and they're a science field are often incomplete. So pandas make the assumption to return enam value in these cases. Later, we will discuss the nen value and details and how to deal with the missing there. But what if the two serious objects have duplicated ending slippers to administrate what will happened? Let's define too serious objects that matches this condition. The 1st 1 will P serious five equal pd dot Sears 10 20 and 30. It's index well p x index and the 3rd 1 wide. So let's run it. This is the 1st 1 or our first serious and let's type the 2nd 1 So it will be serious sex equal pd dot serious and its value as 40 50 and 60 and it will have an end ICS off X in X and they lost one z. So let's run it again. Okay, let's apply Honors Matic operation on them simply we can add them in we both side serious five plus serious sex. It will result in four values off AEX index labels. But why? So we can illustrate with a figure here we have serious five contains two x labels and serious sex contains. Also two X labels and every combination off X label in each will be calculated, resulting in four X labels. So we have the first X value which will be added to the 1st 1 So we will have 10 plus 40 and the result will be 50. Then we will add also 10 plus 50. So it will be 60 and the same for the other labels. So we will have 20 plus 40. It will be 60 and also we won't have 20 plus 50 sold the output well p 70 and we can notes also death. The Y and Z results won't be nan because there is no matching labels for them. So remember, debt and Index can head of implicated labels and uring the alignment. This will result in a number off index label equal into the products off the number off labels in each series. So, for example, two pi to it will be four and 3.3. For example, it's well p nine. Okay, The charismatic operations can also be applied to a single Siri's. When applied, the operation is applied to all the values in the series We can easily try it by multiplying the values and serious three pie tin so we can recall serious three and this is its values. And OK, now we can make the multiplication is really pi writing serious three times 10 So we can knows death. Each value have been multiplied was 10 so the 10 have been multiplied by 10. It's well p 120 have been multiplied also pie 10. So it's 200 the 30 have been multiplied. So it's 300 so on. We can't knows that the operation was applied to all values off the Siri's. Then you must know that all the arithmetic operations like the sub distraction, multiplication and division can be applied to the serious object at the same manner as we have made on the addition example. Okay, this is for this tutorial. Thank you for watching and see you next. Tutorials
7. Reindexing Series: Hey, everybody, what's up? And this tutorial? We will discuss different ways off changing the serious object. At first, we need to define a simple serious by typing, and the serious name is serious. One equal PD serious and its values is 10 20 30 40 and 50. And let's run it so it appears there. The output have an automatically generated and ex according to the label, but for re indexing it. It's very simple. Pie typing serious one don't index and it will pee, pee and cue. Oh, are IHS anti and let's type it again by writing serious one so we can know snail bets. We have change it or we have managed exactly to change Lee Index. But you must know also there. The number off new indices must be equal to the number off serious items, as if it's less or more than the serious items. A pug will appear in your code, so let's try this pie typing serious one. The index equal p que are in this. Now let's run it by type serious one, then the output now is an ugly error, and you must avoid it. But another general inflexible way for re indexing it as for using or pie using the re and ex method. And now let's hit this method pie writing serious, free, equal, serious one don't re index and the embassies will be a p see de and they lost one e. So let's ride serious. Three and we can notes death. All the output items are nan. As all the elements off the new index is different from those off the original series, which, at that serious one in other words, the items off the re index. It's serious, which will have actual values or not. Nan once are only the ones which have the same index related to the original series. We can try this for more explanation. Pie writing Serious three equal, serious one don't re index in inside your brackets. We have be and cue and see and d, and they lost one eat. So let's try. EDS From the output, we can estimate there as P and Q are shared labels, but with the re indexing labels and the original ones, so there are or their corresponding values appears when the original values on serious one on the other hand items appears with man as new labeled index is different from the original ones or at the serious one. And also we must note that any change and serious three will not affect serious one, as they are to separated serious objects. Another example may tell us why it's important, in many cases, to re index. This year's supposed that we have to serious objects, and the 1st 1 will p serious for equal PD serious. And it will have values 10 and 20 and 30 and its index equal one and three and Fife. So let's dry it. And it's clear that the serious labels are paste on some injure values. And we can't write another series here, which will be serious for life equal to BT dot Sears and its values is 10 and 30 and 30 and its index is a string values which is one and three and life and we can execute this line of code. So the notes here it that the index labels are unlike in serious for as its strength here. For this reason, when we try to at Sears for in serious five by typing Sears for plus Souness five. Unfortunately, all the values appears was Nan. As Penders can't make operations on two series with different antics types, for example, injure and strength. And to solve this problem, we need to convert the serious five index from the strength type to the injured type So we can handle this pie typing serious five Don't index equal serious. Five don't index don't values don't as type and their own brackets. And inside it we have in this line off cud lost rate itself as it have converted the index to the Inger value and stayed off the string value. So now the two serious objects are ready for the addition. So for this, we can tie but again with serious for plus serious flies as we have added these serious for items to the serious five items So 10 plus 10 and 20 plus 30 and 30 plus 30 At the end, we can conclude that in this lecture we have discussed different methods off re indexing with three message the index and the area index and changing the index type. Okay, that's for this tutorial. Thank you for watching and see you next. Tutorials
8. Slicing Series: Hey, everybody, what's up? And this tutorial? We will discuss some tips related to modifying serious object in different ways. Office slicing it. Now let's create a pretty serious which represents the students agreed and chemistry exempt and taken to account. There we full Marcus 50. So let's start it. And now the serious as grades equal pd dot serious and the values is 49 200 30 40 flight and the end X is John Smith, Meller and JEC. So that's good Right now you may know step, I have made a mistake when I passed Mess great to 200 as the maximum grade is 50 as we have mentioned. But I deal operate Lee dead it and the reason it that at the feel of handling data, you may find some items which have wrong values or illogical ones which need to be corrected. So for correcting Smith grade or in technical worse, to change an item value, you can type and then grades in Smith. So it will be equal 46 for example, and we can display the values again. Okay, These there are right now, have more stability. But suppose now that there is no way to get the correct A great for Smith, which means that this may affect your there, apparently. Then you can delete Smith Row when you type, and then dill grades Smith and we can display it again. So these are the grades with no value office, miss as you can notes from the output the Smith Row has been deleted. And now what about if we want to slice your data or, in other words, display a slice of it? Firstly, And for more administration, we need to add more items to the series. So let's copy the Siri's and add more items. So the new items here will be 48 and 42 and 39. Yeah, the new students will be merry, Linda and Liza, and we can display It's a gate. So to slice it or to slice our data, we need to write grades and sent zero a colon. Four colon in one this line mean debt. We started scanning from the possession All index zero and end at the third positional index, which has four minus one, and the step here is one. As that result, the output can be as you can see here Exactly. The ends starts from zero Joan and ends at three. Object. So the step is one, as we have for this lait items. But you can also make the step with two for more illustrations so we can write grades to a colon seven and the cola and to. So this means that we have a started from the second positional index at Miller and ended at the Sex Positional Index, which has seven minus one at Lisa. But with step off to and as the step is to or step to mean debt, we will take Miller and cancel Jack Antic, Mary and Ken Celinda and finally take Lisa. And also another way to slice Leader appears now when we right grids in the colon and four so the output can appear right now and an important note here it debt. This line of code means we start from the zero possession, which is Joan to the N minus one possession, which is or at which we have an equal to four. In this case, we can ends at the third position, which is Jack and the inverse can pee right now when we type grades and four and the colon . So here we starts from the end possession, not the end minus one till reaching the lost possession as Mary has the fourth possession. So we started from it and we ended at the lost possession, which is Liza. But these two ways considered that the step is one, as when we started from zero. It took all elements till the third position, and also when we started from the fourth position, it took all elements till the end. And now, if we want to change the step, this line of code will be more staple. So we can write grades a colon, six colon and to as the column six expression tells us that we starts from the zero possession till the 5th 1 while the colon to expression tells us that the woke or our step will be to, As we have a started from the zero possession, we talk Joan. And as these temp is, too, we can sell Smith and took Miller and cancel Jack and took Mary. And we stopped at Linda at the end at the fifth possession. But we don't take it as it's cancelled as the step is to not one another expression for slicing now that debt grades four, double colon in minus two. So this line mean that we started from the fourth possession, which is Mary 20 possession, which is your whether step to but from down to up as the step here is or has a negative sign. So we took Mary and ignored Jack and took Miller and ignored Smith. And finally we talk John. Also, we can inverse this by typing Grid's and four double Colon, and to So the L put here starts from the fourth possession, which is Mary Tell the Los Possession, which, as Lisa. So again we starts from the fourth possession, which is Mary, and we ended at the lost one, which, as Lisa, but with step positive two. And for this reason we have ignored lending an amazing option in a slicing in debt. You can't reverse the serious pie this way, and then we can ride grades double colon minus one. So from the output, we can estimate that the lost element, which as Lisa have become the 1st 1 on this series and another expression can pee right now that grades. Colon minus three, which allows us or this line allows us to start from the first item, which is Joan and ends at the Lost one, Minor three or the lost item minus three, which at the fourth item which corresponds to Jack. And you must know that I am talking. It helped the item here, not the possession. As the item starts from one, probably possession starts from zero. But if we reverse it, this expression, we can side grades minor three and the color, so it will lead us to the last three items. The last thing it that slicing can people formed using be labeled index itself not on Lee the possession of one, even though the index as a string or any type off variables. So we can't right now and then we can ride grades smith a colon and lend it so the output starts from the first item which we have a specified, which as Smith, for example, here and ends with the lost item which also we have a specify it, which is lending at the end. We can conclude that in this lecture we have discussed some tips related to modifying the serious object and different ways Office slicing it. OK, this is for this authority out. Thank you for watching and see you next Tutorials.
9. Creating DataFrame: haven t party. What's up? And this tutorial? We will discuss a new definition. Impending. This definition turns the power of pandas to be two dimensions. Do you know the relational database tables? The simple shape of tables used to deal with which have rows and columns. Yeah, Yeah, that's hit. However, even the compassion is limited as this one has a very distinctive qualities. So our new definition today as the data frame and in this tutorial, we will learn together how to create it from scratch. There are several way you sue created era frame at first using a single serious object. And we can use an example of the total sales for the famous companies like Google, Microsoft and Yahoo and Facebook. So we can start populating a serious object. And it will be for these companies sales. So sales equal PD dots serious and its values will be 200 300 405 100 and the index will be for our companies. So it may be Microsoft. Google. Yeah, who and Facebook. And we can display it now. And sure there these numbers may be in millions or billions. Okay, let's create the they're afraid. So we can write d F one equal pd dot did a frame and 2000 and 70 in the colon and suit so we can display it now. So we can note that from the out book this 2000 and 70 as Lee Colon name and these values here, which held the company's name, are the index off our data frame. So that's a great we can notes there each serious object for Miss a column and the Dera frame, as we have here. This data frame consists off only one series, so we can create at their frame pie using multiple serious object. Also now we can define a new service object, but we can copy the 1st 1 and modify it so it will be for sales to, and we can change the values here off the series. So it may be 150 for example, 253 154 150 and also we can note that the index will be the same as we will handle with the same companies. Partly change, as we have mentioned, will be on Lee and the values or and the sales, and we can display it now. So this is the second series object and no also, let's define another serious object, which will be Sears three for consisting our data frame, and we can edit its values or the values off the sales. So it may be 100 and 203 104 100 for example, and let's display it. So now, at the same matter, we will create our data frame and let's define it with D F two, and it will equal PD did a frame and 2000 and 70 for sales and 2000 and 60 for cells to in 2000 and 54 sales three. And now we can display it. So we can note that each value off the serious object can have a corresponding value off years so this year can corresponding or can represent the column name and also sales to have a corresponding value off year, which, at the column name which has 2000 and 60 and also for the cells three. So it have a corresponding value off column name and these pills three for the 2000 and 50 years. Okay, we can deter mined the dimension off the data frame, using its shape, property and let's do it now pie writing D f to duck shape so we can see that the first value as the number off rose and the 2nd 1 is the number off columns. Okay, we have created at their a frame object, and we have deter mined at shape. Now, if we want to change the column name, we won't you? The column function as we have a function for column at well, p d have to dilute columns, and we can use samples off name for our columns, which will be a for example, be and see. Now let's recall the data frame to see what have being to change it. So we can't notes that the column names here have peanut changes to these characters, a PC and a seat off our years. Then index labels can likewise be change it using the end X function so we can write D F to the index. For example, we can write M s. It will be for Microsoft and G for Google, and let's write y for Yahoo and F for Facebook. And let's recall now the did a frame. So DF two Okay, As it appears, we have a change of the index labels, as we can see here. Good. Now we have a change of everything and the debtor frame. But as in the serious object, we can access the data and there a frame object. But at first, let's recall the original data frame without any modification. So we can copy at, and we both copied the original one without modification. And that's it. So the columns name can't be accessed using the column prosperity. So we can't ride d f to duck columns. So these are our combs and pie. This way we can access it or detective. And likewise, the index off the data frame also can be accessed using the end X property so we can ride d f two don't index. So it appears now. These are our index labels off the original Sears and we have access at now. Okay, we can conclude that we have learned help to create a data frame object and how to deal with it with some off experts. That's for this tutorial. Thank you for watching and see you next. Tutorials
10. Operations on the DataFrame Columns: Haven t party. What's Up? And the sartorial. We will discuss some operations related to the dead. A frame corpse. At first, let's recall the serious objects which we have discussed on the previous tutorial and also the data frame paste on it. And then we can write, says one. Equal pd dot serious and the values are 200 300 405 100. And the indexes for Microsoft. Google? Yeah, who and Facebook as serious one corresponds to the company's sales on one year so we can copy this one and place it again for sales to and we can modify EDS and the values well P 150 253 154 150. And the end X will be the same as we have the same companies, and we can copy it again for the sales three. So it can P 102 100 304 100. Also serious. Three corresponds to the sales off these third year. So now we have compliant them to create the data frame, which, as DF one equal to P T dog, did a frame in 2000 and 70 and the colon. So it won't be for sales one and a comma and 2000 and 60 and the colon. And it will be four since sue in the Kama and 2000 and 50 Colon and sells three. Okay, this is our dinner free. And no, if we want to access specific columns, we can write and then d F one in 2000 and 50 comma 2000 and 70. Okay, it's a clear now. We managed to access the first column, which as 2000 and 50 and the 3rd 1 which is 2000 and 70. But now, if we want to use the Panda Sul to display specific columns and rows off the debtor frame at the same time, so it can P pie this week and this D F one double square brackets 2000 and 60 and then 2000 and 70 don't head. And between the around packets, we can write three. Or we can type three as here. We have expressed the lost two columns or the sales off the last two years, and at the same time we have a specified the lust or the first here we have specified the 1st 3 rows as we have passed three inside the Heather access er that's good for head, as we have discussed the details off at in the series object and the same for selecting columns with rose off the lost ones off the data free. So we can't i d if one double square brackets in 2000 and 60 comma 2000 and 70 duck teal and inside lee brackets, we will try a three. It seems off the output that we have specified the lost three rose as a result off using the tail access, sir, with respect to the accessing off the lost two columns. Also, as in the serious object, we can select specific not from the top and not from the bottom rows. So we can specify some rose by using be take access. So for this, we can side d f one double square brackets in 2000 and 60 comma in 2000 and 70 Don't take and around Crack it in square packet inside at zero and two. Okay. Also, we have a specified the lost two columns and the rose off the possession zero and two. But you must know that the output of the previous lines is also another dare frame, or its type is exactly a deer A frame. And we can prove that when we type, then Taib and round crack it D F one in double square brackets. 2000 and 60 comma 2000 and 70 don't head and inside at three or inside the Practice. Three. So it's type is a deer a frame, as we mentioned. But there's a trick here which it that there is a wide difference between these two upcoming lines of code. So we will write two lines of code, and we will see the difference between them. So the 1st 1 is D F one and double square brackets in 2000 and 60 don't head inside it. We can write three, for example, as this one is exactly a data frame object and the same type off the previous, or it have the same time off the previous one, which we have type just now. And we can prove debt by this type and their own packet, and we can't help you this one, and pace it so from the output. It appears also that it's a dead a frame, but the second line is D, if one and on Lee one bracket and inside at 2000 and 70. Don't head and inside a three, for example, and from the output appearance. It doesn't look like a data frame object, although we have called at with a dera frame name, which, as DF one. But indeed, pandas handled this expression as a serious object, not a data frame, and it's type. Also. We can write it with type and copy this one in peace it. So Pandas tells you death. It's a serious object, not a dinner frame. So the key here and the Centex off the expression, as when we type at single square practice. It's considered at pendants as a serious object like this one, which we have mentioned here. So it return is at serious object. But in the double prakit Centex like this, or like this one, its return, it's now that they're afraid so hope. This is clear now, but no debt. There is another way to retrieve as specific column, but at first we need to convert the column name off our Dera frame to strength and a state off injured, as we have made on the previous tutorial, so we can write D F one dot columns and at practice and inside at a string off a and then P and then see so we can express our data frame Now. Now we have a change in the dead of frame columns here. Names 2 a.m. PNC. So now to access the columns with this method, we can tie de if one don't eight. That's it. You can see that it's a pretty column, which we have just retrieved. But what about if we want to get its possession? It's very easy. Buy this line so V one equal d f one don't columns don't get underscore, look. And inside the practice we can write eight, and to retrieve it, we can ride V one. So it's a clear now that the possessions off a columns on the data frames looks like the series index, as both of them starts from zero, not one. So this line of could mean that we have to find a valuable which is V one, and we have made it equal to the location off the variable a which we weren't So this is the there a frame or our dear framed columns? So we have access one column and we won't now to get the location. So we have, right? Don't get underscore. Look. So they're Centex forgetting the location off our column so we can conclude that in this tutorial we have discussed some operations related to the Dera frame columns. Okay, that's for Distrito. Riel. Thank you for watching and see you next Tutorials.
11. Selecting rows of DataFrame and Scalar Lookup: Hey, everybody, what's up on the previous Satori? Um, we have discussed how to select columns and the data free. And in today's tutorial, we will discuss the different methods off selecting Rose. Okay, Do you remember when we were selecting Rose and the serious object? We were yielding the square practice operator. But as we mentioned before in the dead of frame object that we use this operator to select columns, not rose. Yeah, that's right. But except for a specific case, which is when we are slicing, let's create now. And new data frame object was multiple. Serious object. We will you the same example off the previous lecture. So let's start now. The 1st 1 will be cells one equal Pedido Sears and 200 304 105 100. And the antics, as we mentioned before Microsoft Google Yeah, who and Facebook. And we will copy this one and ride the 2nd 1 in the 3rd 1 So the second well will p for since two, and we will modify the values to P 152 153 154 150. So the 3rd 1 also well p in its values. 100 200 304 100. Okay, now let's create the did a frame. So it will P d f equal PD there a frame and round packet and curly bracket in 2000 and 70 in colon for cells one and comma and 2000 and 60. Colon sales too in a coma and 2050 Cullen and 53. Okay, this is our dead afraid object. But don't get bored and see why we have to carry out the debtor frame from scratch. Each type because they want you to pee familiar while decoding. And we'll be creating at by yourself so we can slice the rose off the data frame using its index possession or labels. And we have discussed different ways to slice in serious object. But we will apply some of them on Lee as example on the data free so we can ride the F and zero call on three color and what? Okay, this is our slicing. And as you know, this line of could mean debt. We start from the zero possession to the three minus one possession, so it returns the rose and possession 01 and two. Okay, Another example. Well, P D f and colon and to So this starts from zero, as we haven't specified as 13 possession and ends at two minus one, which will be one so it won't return. Rose and possession zero and one, and the remaining won't be the same off the serious object. You can watch the tutorial again if you can't remember. But attention, please. We won't face a very common mistake, including That's because we are familiar with using this square practice operator to select Rose and other language. And when you use this operator, you won't receive errors, and it will be difficult to identify the problem. So when we write D F zero and one or coma one so there will be an error here in the Dera Free, we can select Rose with this operator on Lee for slicing. Anyway, we used to shy away from using deafness it because off confusion and to use a high performance coop, we usually use the look and I look indexers to re three the rose off the data free. We have also discussed the look and I look indexers and the serious object and they are the same off the data free. But we will accept Lay in this example to rein force this point using the dead, afraid as we know that look, indexer can retrieve Rose very and ex Labour's so we can type and then d f don't look in double square brackets inside at Google and Facebook, and you can see from the output. Here we got the rows of Google and Facebook labels and the same for the I Look, which retrieves the rose their index possessions So we can't i d f do I look double of square brackets in sight as zero and two. So from the output here, we can get the rope possession from zero, which corresponds to Microsoft label and the row to which corresponds to the yellow label. Okay, The last method off selecting grows as pie Polian selection. We use Polian selection to select rose, which corresponds to special logical conditions. Apply to values of data, not be index or the column. At first, we will create a new data frame object, so we type d f two equal PD did a frame and round practiced and the curly bracket inside at a in the colon. Sales one and P and Colin Sales too. See colon sales of three. So this ad, the output off our new data free as an example, if you want to know the companies which made sales more than 300 part in column A so you can type D f to a more damn 300. So this result is a series that can't be used to select the rose where the values as through. Now, to get these rose, we will copy this one and paste it inside d f two and square practice so you can see that we got the rows which have true values in our condition. So the output here is row off Yahoo and Facebook. So these two ones have the values which s troop. And now what if we want to know a specific value and the dera or a specific item not a row of values or a column of values? We are going to use these killer look up. So Skillern look up values campy Deng using to access hers. The 1st 1 is 80 access er which access the values with the label off index and column. But first, let's recall the data frame to see it so we can't i d f. And now let's access the values of Google sales and 2000 and 60 so we can tie D if ad Google and 2000 and six as we see the output as 250. But here we use the label off both and X and column. But if we want to access and value with possession, we have to use the possession for Post Index and Column. So, for example, let's get the value for Microsoft and 2000 and 70. Microsoft has possession zero and 2000 and 70 has possession to, so we can't I d f don't I t zero and two. So the value here as 200 as we have used the I 80 access er to get this value off the possession one or at based on the possession one know the index or the label one. Okay, we can conclude what we learn it today. We learned it upheld the square brackets operator treks and selecting Rose with different methods. Certain with the look and I look and every lost, we discussed how to get Rose Pipe Julian selection and making skill. Er, look up using the 80 and 80 access er's That's good for this. It Auriol Thank you for watching and see you next tutorials.
12. Modifying DataFrame: Hey, everybody, what's up? And this tutorial? We will continue discussing some operations related to the debt free, and we will use the same example of the serious objects and the debtor frame of the previous tutorial. So now suppose that the data frame which you are handling has the wrong column name and you want to modify it so the renamed function can meet your needs. And that's it. So we can tied new underscore d f equal de underscore f one Don't rename and round frack it inside it Columns Equal and curly brackets in 2000 and 50 Colon 2000 and 40 and we can write new underscore D F to express the output as here we can initialize and New Variable, which, as the new underscore DF. Then we give at the value off our data frame de underscore F one. But after modifying its first column name and therefore the new data frame appears similar to the original one except the change of the first column name from 2000 and 50 to 2000 and 40. But notes also there. The original data frame has no changes at anything. As we have passed the changes to the new variable. But now, if we want to rename the column by passing a modification toe, the original data frame itself, we can't i d underscore F one. Don't rename in Around Packet inside at columns Equal and the Curly brackets in 2000 and 50 2000 and 40 Coma and in place equal. True so as the in place equal true expression means that the modification will be on the original debt free, and we can prove that when we type d underscore f one dot columns. So that's it. The change is exactly done on the d Underscore F one from 2000 and 50 to 2000 and 40. And now what about If we want to add a new column toe the data frame object, you easily answer that we may define a new, serious object and recall the did a frame DF one. Then air the new series to it and at the same manner or at the same matter we made with serious one Serious too and serious three. But this missile looks like importing one and not efficient as we can add the new colon pie typing de underscore F one and square practice inside at 2000 and 30 and the values will be on S square practice and it will be, for example, of 50 and 70 90 and 110. And we can recall the data frame. So from the output, it seems that we have added a new column called 2000 and 13 and passed its value to the dead of frame column. But also, you can do the same Pirie calling the did a frame D F one and copy it, and we will add 2000 and 12 and the colon and practice inside at the values maybe 40 50 60 and 70. And we will recall the dinner frame again. So we have added a new column, which has Tooth hasn't and 12 and passed its value inside the D F. One itself outside as the previous method. But what about if we want to add a new column at specific possession with respect to other columns? Don't worry. Pandas can solve your cooling problems so we can ride d underscore F one, though answered in around crack it inside at three comma 2000 and eight comma and square brackets and insight at the values maybe 2030 40 and 50. And we will recall the did a frame again. So here, as the n third methods allow you to answer and new column as its parameters are the possession at which you want to answer the column and I am talking upheld the possession, which asserts from zero, not one. So I have added. And You, Colin, which as 2000 and eight on the third possession and the second parameter as the new column name and the third parameter as the column values hope that's a clear right now. Now we need to change the column names so we can type the underscore f one. The columns equal and square practice inside at the new names. It may be a P See de Andy, and we will recall that again. So we have a change in the names off the columns off our dinner frame, and we need these new names on the next example. So all the previous ways for adding new columns to the debtor frame. But now if we want to modify and exist column value so we can use d underscore if one. Don't a equal the underscore f one dumpy over to, and we will recall it again. Here we supposed dead. There is a relation between the say's off the column A and the says off the column p. So we have set the values of the column A to the values off the column p over to but hell to delete a column simply. We have three ways for deleting color. The 1st 1 is by using the Dell parameter so we can't i d l d underscore F one and square brackets inside at eight. And now let's recall the dinner frame so you can observe their The column A has bean deleted, and the second method is by calling a parameter, which has called the pope parameter so we can write poop underscore method equal de underscore F one dope up and round brackets inside it, Pete and we can run again. The data frame as we have initialized variable and make it equal to the column, which we want to delete, which as p. But you may ask, what is the difference between the dill and poop parameters? The difference. It there the dealt can't return anything, however, the pope can return these serious, which is deleted. In other words, the poop message variable, which we have created will save the serious, which is deleted from the debtor frame and not also dead. The change, after deleting the column, will appear on the original data free and to prove that we can ride poop underscore method . So, as we have mentioned the deleted serious as a steward and the book Method Variable and now it will be pitter to illustrate the Third Way, which is called the drug method, using an example so we can write drop underscore method equal d Underscore F one. Don't drop round practice and square brackets inside it D and the Kama in exes equal one as the drop underscore method is a variable, and it can have any name party named. It will drop underscore method Onley for clarification. So at this variable and you did a frame well, p saved after deleting the required column or row, which means that the original Dera frame, which as the underscored F one will have no changes, and the d underscore f one drop, means that the data frame, which we choose as the underscore, if one and the value inside the practice as the row name or the column name, which means that we can specify a row or column to the lead. But this depends on the axis value when we make it with one, this means that we will delete the column. And if we specify at West zero, this means that we will delete a rope. And this line of could have Bean used to delete the column, which have named the as we have Made the axe was one, and we can prove that by recalling the drug method so we can write, Drove underscore method. So from the output, it seems that the column has been deleted. But now, if we want to de literal so we can write drop, underscore method equal d underscore f one Don't drop and round Crack it inside of square bracket and let's pass the Google Room and the Axis equals ooh so we can recall it again. As you can see from the output debt, the Google Road has been deleted so we can conclude that in this tutorial we have changing a specific column name. So let's tie changing a specific column name. And then we have added and new column pie, different methods So we can write, adding And you Coolum. And then we have a change of the values in specific column you can write changing values in specific column and at lost. We have deleted a column or rope with different methods. The late styled deleting column or rope. Okay, that's for this tutorial. Thank you for watching and see you next Tutorials.
13. Modifying DataFrame 2: Hey, everybody, what's up in the Satori? A. We will continue talking about some tips off handling the debt free. Now we will use the same their frame of the las editorial. But we have added another one for more demonstrations. So this data frame represents the say's off another four companies on the same three years as it depends on these three serious objects at first supposed bet we have to their frames , which we want to make a Mex off them. Or, in other words, at some rose off the 1st 1 to other, some off the 1st 2 For this, we can use the pending parameter. So for mixing grows off the first data frame and another rose off the 2nd 1 Let's type and then EP one equal d f one do upend and inside the brackets DF two And now let's run it. So what happened is death. The rose off the first data frame was added. Then the rose off the 2nd 1 or the second data frame was added to it, and the reason is that we type the D F one at first and the previous line of code, but we can make the inverse by typing AB two equal D F. Two don't append and inside Leap rackets D F. One and let's It's Riot. So from the l put, we can notes there, the second data frame has Bean added first, and the result is a new data frame, which is saved. Emily, apt to variable as the original to data frames, have no changes. But you may know step. We have made the same names off the columns off the original to data frames. So their names as 2000 and 15 2000 and 16 2000 and 17. So what about the A? Pending if the two data frames have different column names from each other, and now let's modify the DF two column names and see what will happen so we can copy Ed and Paste at a gain and modify its names off columns to 2000 and 12. Then 2013 and we lost 1 2014 Okay, now we can make another mix of the debt of frames and let's type to equal D F one. Don't up end in slight crack. It's D f tube and let's see the output as a logical result, the first data frame has not values for 2000 and 12 2000 and 13 2000 and 14. So it appears with men and the same for the second did a frame, which has no values for 15 4060 in 2000 and 17. But we have a note here which it that if we want to ignore the Rose labels off the two dead of frames which arm exit, we can type D F. One do append and inside leap rackets. DF two comma ignore under index equal True and let's run it. Then you can observe depth. The index has been converted to zero labeled index in a state off the original ones or the labeled ones. And now let's dive again until the first data frame so we can recall at so that's it. But now suppose that we want to add an euro to the debtor frame so we can type D F one duck . Look inside the square brackets. MP, I equal 70 90 in 120 so let's run it. I think that this line of code as clear as we initialize a new role name, then passed its values and the result as the neuro. As you can see from the output now we want to pass as killer value to specific item off the debtor frame or, in simple words, we want to change an item value easily. We can do it. Where the i x axis er so we can't I. D F one, don't I X inside a Google in Comma 2000 and 17. So it will be equal. 250 and let's run it. Oh, let's see what have happened Then there's still us that the i X axis er is duplicated and it's recommended that to use or it's committed to you. The look and I look access er's. But anyway it works and it means that we have a change of the second role. Certain column item to be 250 in a seed off 300 and not also dead. The change is made to the original data frame. We can't do the same also with the I look and the look taxers. However, in the field, off working, we prefer to use the I look as it has the highest efficiency and performance. So we can't i d if one duck look and inside the brackets Microsoft in 2000 and 15. So it will be equal 150 and let's run it. Okay, we managed also to change the first column first throw to be with 150 STD off 100 with the luck access er's and let's do that with the highest performance access ER, which have the I look. But we know off the last tutorial back, the I look works with the possession, not the label, which means that we need to know the column possession and also the row possession. So in this simple example of Dera Frame simply, we may work with the Ruoff second possession and the column of the second position also. But when you handle an extra large data frame, it will be very hard to detect these possessions, which means that we want to get the column and row possessions first before getting the item itself so we can write Yahoo underscore possession, equal D F one deal index don't get underscore, look. And inside the preK, it's yeah, and the second line is, says underscore possession equal de underscore f one Don't columns don't get underscore look! And inside the preK it 2000 and 15 and the next line is de underscore f one. Do I look and Yahoo underscored Possession, comma Seth, underscore possession and it won't be equal. 334 something. And let's it's right now. So at first we have detected the required throw possession and saved at M B A who underscore possession variable. And then we have detected the require Cohen possession and save it. And the fifth underscore possession variable also and we passed these two variables to the I look access er to change the item value to 330 as you can see her from the output. So the value have being a change it to 330 as we want. We can't conclude that in this tutorial we have used the A pending method to mix two dead a frame. Then we added at Roto the first did a frame at lost. We have a change in a specific item value using the i X look and I look parameters. Okay, that's for this tutorial. Thank you for watching and see you next. Tutorials
14. Arithmtic Operations: Hey, everybody, what's up in the sectorial? We will took upheld the arithmetic operations in did a frame object and we won't use this dinner frame to explain it. We have discussed the concept off applying charismatic operations on the serious object, and today we will extend this concept to the data frame. As you know that if we apply and Earth medical operation, it will be applied to old columns and rows. For example, if we multiplied our dinner frame pie to when we're i D F. Times two, as we said, all values off the door frame will be multiplied by two. But what if we perform it and charismatic cooperation between a serious and the data frame object? We can select a row for our data frame and save at two a variable to pee the series, which we work. Um, we can select a row off Microsoft, for example, so we can tie V one equal d f Don't I look and inside the brackets? Let's say zero and let's run it. Now we need to apply an operation between the serious object in our dinner free, so we can, for example, sub distract it from the data frame. So let's time d one equal d F minus V one and let's run it as we see in the output pandas at first align the serious and extruded airframe columns. This operation we refer to as Row Wise broadcast, then applied the operation to each row and the dinner free. So the first throat with the same values. So all the results will be zero and the second row and 2000 and 15. So Gogel become 100 yellow become 200 Facebook becomes 300 so on and the same works when we reverse the operation so we can type D to equal view on minus D f. So let's run it by typing D to So we got from the output. The same result part went a negative value. And now what if the labels off the dinner frame is not found in the series object? We can generate a new serious with Onley labels off 2000 and 15 and 2000 and 16 and cancel 2000 and 17 to see what will happen. So let's type V two equal view on in practice Inside at zero Gholam and to and run it. Now let's apply an operation. For example, we can apply an addition. So let's type V two plus de if, as you see in the output debt 2000 and 17 column was filled with Nan. But because, as we said before, pendant aligned the serious and extend the debt of frame columns and then apply the operation. Okay, Until now, we discussed how hours Medic operations is applied directly touadera frame and between a debtor frame and the serious object. But what if we want to apply charismatic abrasion between two dead of frame objects? Let's go down and see what will happen to the output. So let's side d f. Two equal D f and inside the brackets zero colon to colon and one and let's run it. Here we met these certain possession zero and the ending position to minus one, which means one and the Stivers one. Now let's add them so we can't i d f plus d F two. As you see here, we only got the l put off Microsoft and Google, which means there pandas will align by both the colon and index labels. And now let's a try this time making specific rows and columns from the dinner free. We can, for example, take the 2000 and 16 sills for Microsoft and Google. So let's type D F three equal DF in practice inside at zero in the colon to colon in one and another. Double square brackets inside at 2000 and 16. And let's run it so the same off DF two. But we have a specified Onley sales off 2000 and 16 this time. So this is our output in we can know skip. Now let's add them. So for ending them, we can side DF lost DF free. I think I don't have to say what happened this time. Yes, again penned this aligned with both index label and column labels. So we get values on Lee for Microsoft and Google in 2000 and 16. That's for charismatic operations on the data frame object. Okay, that's enough for Distrito Riel. Thank you for watching and see you next. Victorians
15. Hierarchical index and reindexing : Hey, everybody, what's up? And the Satori a will took, upheld the re indexing and the hierarchical or multi indexing off dinner frames. Now we will use the same data frame of the last tutorial. So let Sister on a previous tutorial. We have knowing how to change the index of data frame. But suppose there the index, which you want to replace, has a crucial there, which you want to say. For this reason, we need to reset the end X. As in this operation, we need to make a new endings off the data free. But at the same time, we will make the old index as the column and the data frame. So let's type D if to equal d f one. Don't reset, underscore index and practice and let's run it. As you can see, the old MDX has been submitted as a new column and the dinner frame and the new end X, which is being passed as the full possession of one. And also you must know their the modification will be on the new data frame D F two, which means that the original won the F one will have no changes. Also we can set any column of the debtor frame to be its end. Exp i d f two they said under a score and X and round brackets and let's make a value with 2000 and 16 it appears now badly. 2000 and 16 column at the new end ICS as we pass it to PD parameter off the set, underscore and Ex function. And also remember there the change has submitted to the new variable, not the original data frame. So here we have reset our index and set a specific column as the new endings. And now, another way off free indexing is we can type new underscore index equal de underscore f one don't re index and round brackets inside at index equal and square brackets in Microsoft, for example. Google. Then let's type y for yellow. And if for Facebook, and now let's run it. And here the change is made on the new variable, not the original data free, but a very important note here. There, the new end X label, which has defined before or has corresponding values of Dera like Microsoft or Google, will appear in the output with its corresponding value. But as why or if labels has no corresponding values off the era, it appears with men. So I want you to know that the Rose values off this method off re indexing defense on the new labels itself. So if the new labels have previous defined drove values like Microsoft or Google, it will appear and the row off the data frame like the output here. But if the new index labels looks like why or F, which have no defined values off rose, So the logical output will be nan for these values and the same concept. Campy, done if we want to change the column names. No, the row names so we can tie V one equal new index re index and inside the practice columns equal. And let's set the values with 2000 and 17 in 2000 and nine in 2000. Okay, from the output, it seems that the change here has saved in the V one variable, while the original data frame has no changes and also as the name 2000 and 2000 and nine have no defined values, and they could so it appears, was Nan. But 2000 and 17 as corresponding values, which was defined before, and the original data frame, so it appears, was its values. Now you can ask a good question, which it debt. What about if we want to make a multi and export a data frame, as in the data frame we has, for example, to general columns, which are able to pee the index off it. So this concept is called the hierarchical indexing and let's dive into it. So let's create a deer a frame for this purpose, which represents the lens off some giraffes with S ages in different countries. So we can't i d f three Equal PD did a frame and around bracket and curly bracket inside at the age and colon and square bracket side it. One, three, five and seven and the years will be or the other column well, p for years. So a colon again and 2000 in 2000 and one, and let's make the 3rd 1 with 2000 and two and the 4th 1 was 2000 and three, and the first country will be Angola and Poland, and the values will be one too 34 and in Zambia, so this is the second country. So the valleys will P 1.2 in 2.2 in 3.2 and 4.2. So let's run it. But now we want to make the age and year as too, and they seems for this dinner free. So let's type multi underscore in equal D F $3 set under a score index and inside, and we can ride year and then age. And let's hear, express the multi end. So in these two lines of code, we have initialized and multi and variable and set it to the multi colon off year and age. And we can prove that we have a multi index for the data frame pie, this light so we can type here, type and brackets so inside at multi underscore and the Bendix. So Pandas tells us that the multi and variable has a multi index. Also, the multi index has distributed to some levels as we have two indices Onley. Then we will have to levels, and that's it. So to prove that we can tied Lynn and inside the brackets multi underscore in don't index don't levels and let's run it. So it's clear that from the output the lens off the 11th as to and each level of these 2 11 school response to a separated colon name and lets its riot so we can type multi underscore in don't index don't levels, and inside the practice we can type zero. Also, we can tied multi under a school in don't index don't levels, and inside the practice would. So that's for accessing each level or each and accept separately as level zero for the first index and level one for the second end X. And now what? Appelt, If we want to select a specific rope at the normal state when we have Onley one and X, it will be very easy to access the row with its index label. But in our case, we have a multi label endings, so we can't access the rope. I the first index or level zero when we type multi underscore in the X s inside the practice, it's 2000. For example, As you see the access er here is called X s inst ead off the I X, which we was using in the single index did a free. And as you see here, we have accessed the row with the index, which, as 2000 for the first index. But for accessing using the second index or the 11 1 we can tie multi under a score. And don't X s inside the brackets three and Levin one. Then you see, we have access the row with the index label three off the second end, X. And if we want to select the two levels at the same time, we can type multi underscore and the X s And inside the brackets, 2000 in the comma and drub underscore level equal fools. It seems that the two levels appears as we made the drop level operator equal force to prevent ignoring any level off the index off them. And now we can conclude that in this tutorial, we have took the pelt, the re indexing of data frame and the high record Kel indexing off the dinner frame also. Okay, that's for this tutorial. Thank you for watching and see you next. Tutorials
16. Importing Data: Hey, everybody, what's up? As we know, penned. This is a tool used for analyzing data, but until now we have learned how to create data from scratch. We learn it also have to create, pose serious and data frame object and learning how to create some operation or how to make some operations on them and so on. But we don't need to create different from scratch each time and analyze it. We will use now data from outside sources so we can get files. Exhale she databases in etcetera. And as usual, we have imported pandas and numb pie lifers and we won't use our data frame again. This time. We will import real data this time. For example, we can import data from Yahoo Finance. So we will open Google and search for Yahoo Finance. Okay, that's the website. So we will up a net as Yahoo Finance is one off Yahoo services which provide financial news data and almost everything upheld Finance. You can take a tour and this website to learn more upheld at but for now we can click on markets here in market, we can get some stock data, so opens took most actives as we can find here, most active companies and the market nowadays. Now let's up in the data off any stock market. So let's a choose whether, for example, or we can tie the name off the Desire company and the search part. So let's type Amazon, for example. As you can see, this is the cemetery of the data. But to get the daily data so we can go to historical data here, we can choose the period off data so we won't get, for example, be data for lost six month is and we will let best as leader fold for historical prices and frequency Will P daily now click on apply. That's a great Our data is ready now so we can click on download data So now the download is completed. As you can see the extension off the deluded fight as CSB we can copy it in pace and in another pause. So let's go to the partition. See now we will add new folder in its name MAPI data underscore files. Now we won't paste our file into it. So see, as we assure cup two comma separated values, as we see here that it consists off values which separated with commerce multiple lines. And each line represents a row in our data as the first line contains the names off old columns. We can't say that CIA's V File is most common format of data we are gonna to use in Panda's as many websites provide data and see a sea formats because it's very easy format to use. Okay, now let's see how to import this while into our good. First of all, we have to define a new variable to save the data and so we can type ends in Amazon equal PD the read underscore CIA's V. And inside the brackets we will copy the past at which we have our file. So let's go to our past and let's copy it as this is our past in peace at here. Then we will tie peck slash and then the file name. So it's a m z n don't see as v Whoa, that's easy. But it seems that the data is very long so we can show some samples off the rose. No, all rose by typing BD don't set other score option. And inside the packets this lay built Max under school rose and the other very pull will p 15. Here we have a specified Onley 15 rows, as pandas expressed, some rose off the top and some rose off the bottom. Okay, that's agreed. Until now, Pandas has realized that the first line as the column names off our data, but it didn't specify any column as an index. So if we won't pan this to realize that a specific Gholam should be the index, so we have to use index underscore cold parameter. So we will copy the same line of good and let's now change the variable name to pee Amazon to now we will have the parameters. So let's type index underscore Cole equal zero and let's run it Great. Now we have a specified the first column, Toby, the Data Frame and X. We can also specify column names while importing data and stayed off the default ones by ending the name parameter. We won't copy again. It's or we will come be our data from again and add the parameter. So let's type names equal in square brackets Inside, at the values will be up in Hi lo close in adjusted close and let's make the last one was volume and let's run it. But here we have a problem which, in debt Bend has assumed that the first line is a part off data, and this will make confusion while analyzing data so we can't skip over the column names, throw and the file when we type Heather equals zero. As you can see Pam, this is kept the hetero and read the remaining data, and we lost. Think it that we can specify which columns to lewd when reading the file. This can't be useful if you have a lot of columns in the fight and you don't need some columns. And the analysis so penned has made this easy, using the use cold parameter. So let's copy this line of good E and PS at here, and we will modify it by adding the use Cole's parameter to it. And let's type use coals equal in practice. It's inside it. Let's specify the date column and the often call, um and, for example, the close column and let's run it. So as you can see here from the output, we have a specified the date column. The up in column and the clothes color so we can conclude that in this tutorial we have learning how to import a specific file. Two pandas. Okay, that's for this tutorial. Thank you for watching and see you next Tutorials.
17. Exporting Data: Hey, everybody, what's up? And the previous tutorial we have learned how to import. See as defies and to pandas. As you can see here we have read Anderson data and specify the date column as our data frame index and use on Lee the date open and close columns. Now we want to reverse this operation. We want to export our data to a file on our PC. We can do it easily, and we can specify the index label also while exporting by typing Amazon three docked to underscore CSB and round packets inside at the path off the file or the past at which we want to save the file and then a slash and the file name, which we want to make and don't see as V and then index underscore Label equal indeed. Okay, that's good. Let's see what happened. Great. Pandas has created a new CIA's V file and exported the data to it. And to make sure we can read the exported file by typing new equal PD don't read underscore CIA's we in his side it we can type the pass off our cuz file hands in slash and the filing dot C as we and index underscore Cold equals zero and let's run it as you see importing and exporting files impending is very easy process. And also you must notes that we made all examples on CIA's fee for man because it's the most common format we are gonna to use. But we can make the same with other formats like Jessen Files or Excel files etcetera. To explain this, let's import and Xel file pie easily typing read underscore excellence Teed off, read underscore CIA's V. So for doing this, we can type Amazon four equal PD don't read underscore Excel and round brackets Inside it, we can copy the past folder and slash, and now we will type the file name and then the extension. So it will be X l s X. So this is the extension for the Excel files and let's run it now. Congratulations. We managed to import the Excel file easily, but here we have a note so we can't up in the file. The data and the file is arranging in separated columns and separated lines. As you see here, not coma separated files like the CSC fights. Okay, that's good for this tutorial. Thank you for watching and see you next. Tutorials
18. Tidying up data: heavy party. What's up? Today we will learn that very important concept in data analysis. This concept is called tidy data, as the first step off data analysis is importing data into our code. But what we will do after importing the data needed to be analyzed. We need after this to rearrange the data for some reasons. We do this because we may have some missing data on as a reason it that we may find units off values may need to be changing. For example, we may have values and centimeter, we need to change at two meter, so we have to change the unit. Another condition in depth. The name of variables are different from what we require. For example, our data is doubling skated and we need to cancel some similar data values. Those are some problems and there are more and mood. But I think that we already now to dive into hell to tie the data up. So let's start by handling messing data. We took the help missing data before and said that missing data are the data which have NAND values. Nan values mean that there are no values a specified for this label, and there are number off reasons why the value can pin n as we saw in some previous tutorials. But the general pointed that they owe care, and we need or we won't need to deal with them to be able to perform correct data analysis . So now let's import the data frame, which we will work on hands in. Let's tidy f equal PD don't read Underscore See is V and inside leap rackets we will ride the past so it will be in the sea protection and the colon and back slash and data underscore files in another peck slash And let's type the file name. It will be Amazon. Don't see SV. I am the index under a score. Coal equals zero. So let's run it, as you see, it appears, was many rows, but we don't need all of these rows so we can specify only 10 rows or the 1st 10 And there . Let's copy our data frame so we can copy ads and then we will slice it. So we start from zero until 10 and the step is one. So that's it. But there is no missing data in this data. free. So let's add some pie typing ans n d have to in practice inside it. Let's live the new column name So it may be, for example, daily average equal np duck net. And also let's run it good. We have added a new column and assigned its values as then and take attention. Also debt we use the square practiced parameter as we are specifying the cooler. And now let's add the role with men value. But wait, wait. Well, we use the square bracket parameter. No, we will use the look or I look so let's hear to use the I look and Zen d if dude I look inside at zero and equal np Delton in and run it. So here we have a change of the values off the first road to P nan using the I log access, sir. And what's more, we can't change a specific value to P Nan also, so we can type hands in D if two Don't I look and let's a change, for example, three and zero. So we will specify this value to be Nan. So let's type MP duck nan and let's run it here we use both index possession, which as three and column possession, which zero to detect the value. And let's do another thing. Pie specifies some values off the close column, for example, to peen in. So let's type de if to Don't I look. And, for example, two and three, Equal and P look nan and let's do the same with other two values. So we can copy this line in piss at two times so we can change the values, for example, to be three. And they lost 12 before. So now let's run it. As you see, we have a changes. Some values off the third positional column to peanut. Okay, this data frame object except the following characteristics that will support most off examples we will discuss next tutorials. It appears that we have one grow consisting Onley off nan values. One column as consisting on Li Nen values also, and several rows and columns consisting both numerical values in nan values. That's for this tutorial and on the knickers senatorial. We will handle these missing data. Thank you for watching and see you next. Tutorials
19. Dealing with missing data 1: Hey, everybody, what's up in today's tutorial with the start dealing with the missing there Or as we refer to here in pandas nan values. First of all, we can know the number off missing there are or missing values by using the is null method . In this method, we ask pandas this question 10 days. Which data is nothing in the data frame? So for answering this question, we can't I d f don't is no and practice. So this is the out. As you see all the airframe values have turned it to Pooley and values was through and fools where the nan values is through and the other values as fools. And to know the number off these through values which represents the nan values and the data frame. We have to sum this result So we will copy this line of good and add the sum to it. Don't some in practice. So from the output here or the output calculates the some off NAND values in each column as here, Open column has soon, and values high has only one and value and so on. And to calculate the total number off missing values, we will some this result. So let's copy this line again and summit so we can die dot some again and let's run it. So that's a great We now know that we have 20 missing values in our data. Another way also to the remind this number is by using the count method. But here we asked fairness which data is not mething NZ data free. So for this, we can't I d f don't count. As we see here, the result calculates non nan values. For example, open comb has eight exist values and High Cove has nine values or nine exists values and so on. So to get the number off nan values, we can subtract the nun Nan from the total length. So for this weekend type Linz and inside the brackets our data frame so d f and minus d f dot count Good. Now we calculated the number off nan values as we made with the some off is no method and at the same as we did here, we can calculate the sum by copying this line and make Ed does some. So here it give us the symbolism, but another way to determine the non name values as by typing d if dot No. No. So that's good. It seems that we have the number off none. And values as we have made here. Okay, that's good for this. It Auriol Thank you for watching and see you next Tutorials.
20. Dealing with missing data 2: Hey, everybody, what's up? And the previous tutorial, we have calculated the Nen and Numb Nan values and the number off each of them. So let's learn some techniques off handling these missing data easily. We can remove these values from the deficit we may need to do this went, for example, we have a system off detecting the daily temperature in it since Lee temperature to the computer to analyze it. But suppose that in a day the computer was off, so the computer will consider these data as nan values. So for this reason, we can't apply a drop near function on their serious object or on a date of frame object, also as it works in both. So let's apply it on a serious object at first and see what will happen. So to get a serious to work on, we can choose a row off our cooed in access it maybe, for example, the row off the third possession so we can tie and then s one equal d f dot I look in his side at three and let's run it. So that's our serious which we have created. But take attention here. We used the I look access er to access the rope I possession And now let's apply the drop now function. So let's type And then as to equal s one Don't drop near and let's run it. Okay, As you see here from the output pandas, drop the item where the value is nan and the output is a new series While the original series didn't to change And we can check this pie recalling s what again, pie typing s one good. It didn't a change. That's for using drop near on a serious object But what if we want to apply it on a date of free pan this for this well drop old rows which have at least one and value So for this we can't I d f don't drop near as we see from the output here pandas drop old rose because all rose has nan values. But if we want to drop rose but not all of them. So we want Onley Rose where all values are Nen. Thus we have to use the how parameter we can copy this line of good in peace Ed And inside the practice we can write hell equal own and running. So as you can see the roles which have all values as Nan was dropped. So we said goodbye to the first row here, and as we use, we can apply it on Columns two. And for doing this, we can access the parameter cold access, which is responsible for detecting the rows or columns by changing its values between zero and one. So for that we can copy our line and add to at X is equal one. So that's good. We have deleted or we have dropped the colon, which have old values western in. But another value off help parameter, which can be used, is any. That means if a column has any nan value, so we need to drop it. But we will create at their frame without the first row because it have all nan values. So we can't I d have to equal. And let's copy this line, he and pierce it here and let's run it. So that's it. So for using the value off any we can type D if to dot drop near inside leap rackets hell equal any and let's make the axis with one for the color. So here, because open close and daily average columns each has at least one and value they were dropped. Okay, that's for this tutorial at which we have learned in some way is off deleting the nan values or dropping it. So thank you for watching and see you next Victorians.
21. Dealing with missing data 3: every party. What's up? And the previous tutorial we managed to handle missing dinner up. I simply delayed ing them from our data using the drop near function. In this lecture, we will use the same data which we have uploaded from Yahoo Finance and also the nan values which we headed. But what if we actually need this nan data to pee exist? Or in other words, we need to felt this data we need to replace these nan values was approx made of values For this purpose, we can use the fill nan function, so let's assert pie to placing an values with specific value. So for this reason, we can type ends and d f don't film there inside Lee practice zero. So here, as we can see, all man valleys were replaced by zero because we pass zero Toby Phil Nam function. But replacing old values with specific value is not efficient. We need to replace these missing dinner with actual values or we can say, with expected values. For example, we have here missing data off the up and price column on the row off. 8 August 2000 and 17. We can expect this value to pee the same off 7 August or, for example, the same off 9 August. So if we expect it to be the same off 7 August or if we want to assign it where the previous value in other words, so we can type D f don't fill near. Yeah, it's widely practiced. It's method equal if filled. So let's run it. So here the f felt means forward filling. So pandas moves forward. And if it found in an value it will fill this nan value will be lost No in value. As we see here, this nan value was full with 990 and also here and the close column. There are three values will fill what they lost. No in value, which as 987. But if we need to assign this value to people value off 9 August No. 7 August. We have to reverse the following operation. So for this we will copy this line of code in pace it and change this flt pete be filled. So the p Phil as the shirt off backward filling and you can notes damn the output or from the effort that Pandas has felt the 8th August value with 9 August, but another common method as to fill old and values in a comb, with the mean off this column and the mean equal to the sum of all values off this column over the number off these values. So for this weekend, type D f don't fill near Ian's inside the Prickett d f I don't mean and let's run it. So pandas here calculated the mean off each column and film each nan value off the column with the mean off this color but notes dead all values off. The Daily average column is nan So the mean off them as logical results? Well, p nan also Okay, Now we reach it toe the lost method which we are going to use for changing the values of the missing data this missile as the interpolation method. But to discuss this concept off interpellation, we need a simple serious object, for example to work on. So let's type s one equal pd serious Inside the packets, we will side, for example 10 and we will have the second value as MP duck nan for demonstration in two other values. off. NP Dutton in and let's make the loss Value is 50 and let's run it. So this is our series and let's tie this one. Don't inter plate in track. It's as we see in the output here. Pandas expects the values in between two known values, which mean adding effects of value to the first known value incrementally until reaching the second known value. So this will be clear in an example. In this example, 10 and 50 are the surrounding values as a linear relation. So if we calculated the slope, it's well p 50 minus 10/5 minus one. So it will be 10. So we can at 10 which at least slow to the first value which won't be 20. And also we can add it to the second value, which s 20. So 20 plus 10 well p 30 and so on sold. That's what pandas make behind the seed so we can see here. Death 10 plus 10 won't be 20 and 20 plus 10 will be 30 and 30 plus 10 well p 40 and so on, so each value will be added to the slope which we have calculated and another example here to rein force. This point is by typing as two equal pd serious una Slide the practice, for example, Let's make it with Sten and tune and valleys and then 50. So let's run it and that's it. So as in the previous example, when we calculate the slope, it will p 50 minus 10/4 minus one. So here it will be 13.33 So when we add the slope which as 13.33 till the first value, which will be 10 sold, the value will be the second point, which is 23.33 And when we add 13.332 the second value, it will be 36.66 and so on, so we can prove that pie typing as to don't inter plate. So it seems that we have the same result which we calculated before. So lastly, we can conclude that in this tutorial we have discussed different ways of filling Missing data starts from the filter nan to the mean value ending. Well, the interpellation Okay, that's for DeSoto. Auriol today. Thank you for watching and see you next. Tutorials
22. Duplicated data: Hey, everybody, what's up in the journey off? Preparing and making the needed pre processing on your data, a common condition that you may face Adlai Duplicate data, Which means that your data may have some repeated rose, for example, or some repeated columns as an error off the data, not as a usual condition for more illustration. We have prepared the same data frame off some companies which we used before, but now with the publication off the Rose, so let's run it now hopes you can see that each row as repeated or double IQ ated. And if we want to detect the duplication off the rose, we can use the doubly Kate parameter. So for this weekend, Type D, if one don't duplicate it and run it. What Penn does make is a scan on the day to frame Rose zero pyro to search for lead application. At first, it found the Microsoft as the 1st 1 or the first rope, so Pandas doesn't consider Microsoft as repeated rope, so it appears with faults. But when pandas went down, it found Microsoft throw again. So pandas consider the second Microsoft throw as a duplicated one and the same concept with other rose. And now what if we want to delay the duplicated rose off our data frame so easily? We can use the drug public AIDS function so we can type D if one don't drub. Underscore doubly Cates Ian packets and let's run it. It's a clear from the output debt each repeated row as deleted. And you must note also that the original data frame has no changes, as this is a new later frame without duplication. Okay, that's enough for the publication. Thank you for watching and see you next Tutorials.
23. How to tidy data up: Hey, buddy, buddy, what's up? In this tutorial, we will start on the next step off, tiding up our data and make the require pre persisting on the data to get it ready to use at first. In four simplification, we will use a simple data frame. So let's tie d f one equal pd dot did a frame in packets inside at Curly practice. And let's make the first variable name Web X and it's wealthy for zero. Let's say 11 three and four and the second column. They will pee, for example. Why? And it will be four or it's values will be five six 88 in Noi. So let's run it. So this is our data free. And now suppose that we have some wrong values and lead it a frame which we want to replace . So the replace function can solve this problem by typing D if one don't replace yeah, round practice inside a cure Leap rackets in X in a 12 p for one And why Well, p for eight, and then we want to replace them with 100. So let's run it. Hear what happened in that Penda search it on the first column for all values, which equal to one and replace it with 100. And the same happened with the second column as it replace on values, which equal to eight with the new value, which is 100 also, and now let's go to the second step. In some cases, we will need to apply specific mathematical operation to each value off the data. Although we took that Help me Mr Medical Operation on Data Frame on a previous tutorial. But now we will took upheld be tiding up, or we are talking upheld the tiding up off our data. So for this we use a function called Lambda. For example, we need to add a value off each item of our data frame. So let's type de if one don't apply and round brackets inside it. Lunda V and Colon V Plus 10 in here. Let's apply it. We have added a value off 10 to each value off our data frame, and you can apply any mathematical operation also. So let's copy this line of code in peace it and change addition to pee multiplication and let's run it So as you can see here, each valley off our data is multiplied by 10 so five is multiplied by 10. So it's equal 50 and so on. And also we can get the summer off each column using the love the function also pie passing de. If one don't apply in crack, it's inside at Lunda Cole and the Colon in cold dot some. So let's run it. Hear it clear now that the summer off X column is nine and the some of the second column or the White column is 36 and also you can do the inverse by calculating the some off e tro not be column by copying this line of cud in peace at here. And let's a change in the column to Pierrot. And then let's make the axis with one so the some of the first row as five plus zero it's, well, p five and so on for each rose. But you may note, also death. We made the axis here with one, but in this line of good it me and that we will add the rose no be columns as we made on the previous lectures, and for more understanding we can apply the same line, but with the X equals zero. So let's copy at in. Pace it and make the access. Who has zero and let's run it. Oops. It seems that from the out book, the function added the columns, not the road, although we type road that some but throw here is only a variable. And what will specify if we will have the columns or the row as the axis here and we made the excess was zero. So we added the columns. No, the road. And now what's upheld? If we want to get these some off some specific rose or, in other words, rose, that meets the specific conditions for the administration. We can change value off the specific column or a value on a specific column. Two. P nan. For this, we can use the I look access er, so let's tidy. If one does, I look inside the practice. Let's to specify the first column in the first row, so let's type zero and zero equal. NP dealt net and let's run it. So that's it for zero position column in the zero possession role as we made that West net . Now let's get the some off the specific rose, which achieve a specific condition. So for this, we can't i. D f one don't drop near he and don't apply inside it. Lunda, Cold, Colon and coal dot some and let's make the exes was one and let's run it. So what happened here that we specified the rows, which have none nan values. And as they result, the zero possession row wills cancel as it have an and value. And now the next common operation, which we apply to a data frame as to add two columns and assigned the results to a new column. This can done it this minute D F. One and packets inside at the new column name. It will be something, for example, equal D F one don't X Plus D if one dealt what and let's run it. So it's clear now that each two values was some, and their output appears on these summing column. So here we have one plus sex at seven in one plus eight. It's 90 and so on. But suppose that we need to change the value off summing column by making a mathematical operation, and yet so for this we can't i d f one dot summing inside the brackets d if one don't x plus d f wondered why and multiplied by two. It seems that we exactly managed to multiply its value off the summing column pie to, as the summing column is now an exist colon. But on the previous line, it was created at first, or we firstly created it. Now we can conclude that in this tutorial we will learn it some steps off handling data on the pre persisting state, starting from replacing till the making or making some important mathematical operations. Okay, that's for this tutorial. Thank you for watching and see you next Tutorials.
24. Concatenation: Hey, buddy, buddy, what's up? In the previous tutorial, we discussed hell to tidy our data up. To get it ready for analysis, we managed to handle missing data, duplicated data and so on. And in today's cereal, we will took a pound. The comply nation of data. Until now we were took, upheld the pre persisting on one day the frame object or one Sears object. But what if we have the data separated into multiple data frame object or multiple serious object? We will need to combine these data object to be able to make correct analysis. Okay. For this, we need simple data set to work on for better understanding. At first, we need them to be with the same index labels and column names. So for this weekend, type DF one equal PD their frame and inside leap rackets. Let's make the first road maybe, for example, 10 20 and 30. And the 2nd 1 will be 40 50 and 60. And let's make 1/3 row. So it will p 70 80 in 90 and let's make now the index sold. The index, for example, will be 12 and three, and the columns MAPI for A B and C and let's run the day the frame. Okay, that's the first data frame, and we will copy it in modify it to carry out the second their frame. So let's copy it in peace at hearing that will be two into. And let's modify the values to P. For example 102 103 100. Yeah, 405 106 100. And so on. Seven AIDS in night. And let's make the index with the same one. And the column names also with the same for the first day. The frame. Okay, now we can compliant them and we will use the concatenation function. So the General Centex all the concatenation data as to pass a less off object till the function. So for this, we can type PD the cone cat in his sight beep rackets. We won't type d f one he and D f two And here this is the outlook Pandas here, aligned post object vehicle of labels. Then the rose was added to the result in order in which we passed them. And as we passed the F one first. So it appears first, we can't change the order to see. So let's copy That's good and change the order off objects. So that's good. The order off them was a change of due to our change as we passed the F two first as it appears first or for this reason, it appears first and then DF one. But what if the data set has distinct columns? Or, in other words, it has a column name which doesn't exist in one Did a frame. Let's copy the F one and paste to carry it, the dinner friend three or And you that a frame and see what will happen. And now what will modify the column name So we will make it was a p D in steel off a PC and let's run it so we can recall the F two again. Again, These two little frame objects have common columns, which, as a MP and this tank it column as DF three has D. But the F two has see now let's come getting hit them and see what will happen with these columns so we can tie pd dot com cat inside the Practice DF two and then D Afrique, as we expected, because We have different columns when we can. Captain ate them at results in a nan here because there are no values for DF two and D column and results in an here because there are no values for DF three and see column. Okay, that's good. While combining data as we did here, we may need to mark this data or to this tangle between each night, afraid to do so, we can use key parameter. So let's copy this line in Adlai Key parameter to Ed by typing V one equal and let's paste it in Adlai Key parameter. So the key will equal de or the data frame to and then the data friend three and let's run it So it looks like multiple index, which we have discussed before, and we use it here to flag each group of froze with its corresponding data. This parameter is important because it helps us in accessing data after concatenation. So, for example, we can access the data which come from there to frame to sores by typing V one. Don't look and inside the brackets data frame to and let's run it. That's good. We managed to access it and take attention that we use the look access er, because we want to access very and X label and we have discussed before. Okay, now, as we said, when we use the concatenation function at Alliance Data Pie column and at concatenation along the row access because the value off the excess parameter is zero pie the fall. But if we want to reverse it, I mean, if we want to ally in data pyro, not pie column and content innate along the column X is simply we can do this by changing the value off access parameter off our function. And to the ministry of this, we can type V two equal pd dot com cat inside Leap racket slates, type DF two and then the F three and let's make the access Ways one and let's run it So, as we said concatenation First Alliance Data Pyros and then concatenation along the column . Access and the same rule can be applied on concatenation along column access so we can change the order off columns by changing the order off data frame objects passed to the function here. And also we can specify keys barometer by copying it he and peace at here and run it done. That's good for this tutorial about concatenation. Thank you for watching and see you next Tutorials.
25. Merging Data1: Hey, everybody, what's up? As the Mexican dinner frames and the relational values between some of them as the popular kids their little scientists frequently face. So in this lecture we will learn a new technique and combining their frames which and the emerging function for today's purpose. We have defined two new data frames, which, as this 1st 1 so let's execute at so this did A frame represents some students name with their levels and a school and their idea. Also, this is to be familiar with what we handle and the second in a frame as this one in Let's Run It. So this data frame represents the students I d. With their activities. And now let's do the emerging operation pie using the merge function as we mentioned. So let's type students don't merge inside the practice activity. So what happened here and that we managed to emerge early to their friends by adding all the columns in a single day? Afraid. But what happened in details? A debt Pandas realized that the two data frames have a column called Student I D. So Pandas use this column as a common column to put firstly and the new merchant in a frame , as this common column is considered as the link on which we will use, or we will make the emerging operation. So the first step of deadpanned this past the Common column, which at the student i d. Then the columns off the fittest did a frame, which, as the name and live in lost lee the columns off the second did a frame, which is on Lee. One column, which had the activities the second instead of debt pandas matches leave values between the two of their frames, according to the keys off the Common Column. And the keys are the values off the Common column, for example, 222 as the key off the common column, which corresponds to lend a and the fittest data frame and also corresponds soup. Ask it and the second data frame. So pandas make all of these values and one rope. The same concept also is done with the value off 111 which is another key off the common column as it corresponds to Miller and the fittest. There a frame and hockey and the secondary frame. So again, pandas make all of these values in one line. But you may note, there the key off 111 repeated two times and the second data frame. So here at corresponds to tennis, but it has no additional value, and the first they're a frame. So as a logical result, it's also be assigned. Or it will also be assigned to the first value off the first day of frame, which is Miller. At conclusion. We will understand from the debt each student has one i d. As the ideas at unique value. So Miller has two activities, while Linda has Onley one activity. But this kid's, which have one common column, is an ideal case. So in real practice, there may be more than one key column. 23 Plop, plop, plop For this purpose, let's use at second group off dinner frame so we can define a new one, which has first underscore calls. Equal PD did a frame and inside the packet, let's make me come one and its value will be, for example, l end em in and and we have a 2nd 1 or a second common column so it will be come to and its values will PP for some, thank you. And let's make the 3rd 1 with art and the number one or the third column will be number one , and its values will be 111 222 and 333. So let's execute it. So this is a simple did a frame, and it will be more clear when. Compare that with the second What? So let's type second on their score. Coals Equal PD did a frame. And inside the brackets, let's make come one. And let's make these values like the 1st 1 with L M and N. And these second column will be come to and let's make their values or its value was be T and or And let's make the 3rd 1 or third column with number two and let's make the first value was 444 and 555 in 666. So let's execute that. So it's clear that thes two data frames have to common columns, which are become one and come to and also to different columns, which, as number one and number two and the values off the he's all the common columns are the same except the second row off the second column as its value as Q. For the first data frame and the corresponding value off and the second better frame is T. And now to discover what will happen when we merging the two. They're framed lights type second, angry score. Coals dealt, merge and inside the practice first underscore cold. It seems that the emerging data frame has Onley to rose, and the reason it that the keys off the too common columns and the to their frames are identical. So L and P and N and or but the third row has M and Q for the first dinner frame and I m anti for the second did a free. So this road was canceled from the new merger debtor frame as the common column job as too lengthy to dera frame when their common keys or values on Lee or their common values. But what upheld? If we want to emerge with a specific key or, in other words, choose our self is the common column pie, which we can make the emerge operation. So for this purpose, we can copy this line of good in peace yet and add another parameter, which has the on parameter. So let's make unequal Come one and let's run it. So that's a great You can see that as old kids off the common one is exactly shirt between the two dinner frame, so we have three rows off the new, they're afraid. Notes. Also, death. We have two columns come to underscore X for the second dinner frame and come to underscore wife for the first data frame as their values have a change in the second row. Q. For the first dinner frame, anti for the second dinner free as this world, the only solution as all the values off the key column exists on the to dinner frames. And also, you must know bad. You can specify more than one common Coolum, bypassing more than one column for the UN parameter. So for this, let's copy our line and pace at here and add another column which may be come to so let's now run it. So best comment. Give us the same output off the first merging comment as we specified here, the too common columns. But the concept now it that we can control the number off common columns by which pandas will make the emerging operation. Okay, that's for this tutorial now at which we start the token, get help Emerging techniques. Thank you for watching and see you next Lectures.
26. Merging Data2: Hey, Vinnie, putting what's up? And this tutorial we will continue talking upheld the techniques off merging data, as always, discussed on the previous tutorial. Walls for Onley. One time of merging, which is called the Enter Merging as in the other, merging pandas specified the intersection off keys between the two dinner frames or, in other words, the keys which exists and the to their friends. But there are three other types off merging, so the second type is called the outer merging, at which panda steaks, the union keys or hold the keys into consideration. And this will be clear with this line of code. So let's tied second, underscore coals and up merge inside the practice. Let's make the first column and let's define a parameter, which is co hail and let's make at equal outer. So let's run it exactly. We took hold all the keys, which is P. T. R. Q. And to account so as numb. One has no corresponding values off the key, which s T so it appears with men and as numb to has no corresponding values off the key, which as Q so it appears with then also and now the third time of merging is called the Riot Merging, at which the kids will be on Lee off the outer. They're afraid so for demonstration, let's copy this line of good. And here let's change the parameter, which is hell and make it with rights in a Steigauf alter and let's run it as the right data frame here, as the first underscore calls. So we use the keys or the kids, which we use as L and M. P. R. Q. So they are the fittest. Dinner frame keys and the output proves what we say as the number two column off the second dinner frame has no corresponding value and the final type as the inverse off the right merging, which has the left merging. So let's copy this lost line of good and paste at and make the right with left. So run it here. It's clear that this is the inverse operation as the keys as L, M and B T or off the second coals that afraid and as the furnace dinner frame has no corresponding value off the tee, very pull. So it appears with men and there Let's go toe the final merging method of data, which as the joint function. But it has another technique in joining to their frames as it joins columns according to the Row and X label, which means that if the two row have the same index label, so their values will be attention to each other. For this purpose, we can type second coals they'll join and inside the brackets first coat. But wait, wait before running this line of code as we have an important thing which dipped. The joining message needs the columns off. The two makes it better frame not to have any repetition and the names, but we have the same column names, which has come one and come to for the two airframes. So pandas have sold it this problem pie passing some parameter to distinguish between the same column names and different their frames. So let's side the first parameter, which, as l suffix you cool and let's make the variable name Wes underscore Second and the second promise her, as are so fixed and let's spigot equal underscore first, for example, me and let's run it. So here we have a specified different column names by adding the other score, second for the second dinner frame. Common column and the underscore first for the Finisterre frame Common column. And it appears from the output there, the joining defense on the index labels as the index, all the two airframes as the same. So the joining operation is done smoothly, but for more understanding less to change the second date of frame index labels so we can survive. Second, underscore coals the index and let's make It was, for example, zero long and three. So let's run these second underscore cults there a frame and there we are ready to make the joining operation. So let's copy this line of good and peace at a gain. And now let's run it. So what happened here there? Panda selected the second in a frame index labels, which, as 013 as we have a specified it at first. But what if we replace the possessions of the two dinner frames so we can make the fittest underscore? Calls the 1st 1 or we make it on the outer and make the 2nd 1 on the ener? So let's run it here. It seems that the index labels as 012 art for the fittest underscore calls. They're afraid because we specified it at first. But as the emerging technique, the joining the full value off help parameter as outer joining, and if we change it at to the enter sold, the results will change. So let's now copy this line of good and paste at in Make the help barometer to pee with Enter and let's run it. So it seems now that the joining operation is done over the 1st 2 rows on Lee and the third row was cancelled as the third row off the to dinner frames has different labels. Okay, Hope this is clear right now. And this is for this tutorial. Thank you for watching and see you next Tutorials.
27. intro to SAC: haven t putting What's up. In today's tutorial, we will discuss an important concept in pandas this concept as crew being data. So why we need to group data to answer this question assumed that we have a large set of data. For example, we have data collected from our Kiev from 2000 to 2000 and nine. This data is very complex and to peg for a single computer to analyze, can you imagine data which is collected daily over 10 years? I try to make this example simple, but you may have data with Pilyeon of Terra pipes and you won't have to analyze it. So the solution here won't be splitting this data enter groups and our example here we can split this data into 10 groups. Each group represents at full analyze process. For example, this group won't be for our Keith data and 2000 and we won't make full analysis on this data and calculate the result and the same for 2000 and one in 2000 and two and so on. So at first we split the data and then apply our analysis and each system and calculate the result and Finally, all the results are Kim Pine pick together and represent as a single unit and use for decision making. This process follows a pattern, knowing as splits apply, comm pine as here again with fled the data into small pieces or into groups, and then applied the required analysis and process and finally collected the data from each system and generate. We find the results. That's good. So, as we said, many data analysis problems follows At pattern off processing data known as sac or split, apply comm pine First, a step is a splitting our data. Enter groups, then perform analysis and calculate the result, then collect the result and combined them. We have another example here. Assume that we have a simple competition and these are the results off. We have three competitors, Jack Smith and Linda here, the result of the first round. Jack scored seven points, Smith eight points in Linda's court, only six points and the second round's result also, as we see here, and the same for the lost round. Okay, now that's our data, and we need to analyze it. Our analysis aim is to get the total score for each competitors So here we can apply our SEC pattern or split. Apply, compliant. The first step is split. So here we will split the data, depending on the names of the competitors. So it's well, Pete splitting into three groups, group for Jack in group for Smith and another group for London. Good. What is the next has said? As we said, Split, apply, compliant. So now we have to apply the operation required. We will add the score for each of them and the loss of step as Sue. Collect the data and Compiegne and into a single system. And we are done. Okay, hold. This is clear for this tutorial. Thank you for watching and see you next Tutorials.
28. Grouping Data: haven t putting What's up In this tutorial, we will start with practical coding examples to apply on the principle of sex or split apply compliant, which we start talking upheld on the previous tutorial at first in four administration, we have important our data set as you will find the file, which, as grouping and lead, it defies which you have downloaded. So this data represents the number of people who visited the websites off to famous companies Amazon and Yahoo in four specific days as the first column represents the day off , visiting as the four days are 2122 23 24 and the second column represents Lee Company name as the fittest. Six rows for Amazon at the fittest. Two days, which s 2122. But the last six rows for Yahoo Adlai Lust Two Days, which has 23 24 and the third column represents Lee Traffic way, So each company has three ways. The first is the promotion and the second as Lee As and the third as pie. Searching on the search engine like Google being etcetera and we lost column represents the number of visitors and millions on each day by each of traffic source. And these numbers is not accurate, but only for demonstration. So let's a start now by applying the require operation on the given data. At first we need to put the data into some groups and it appears here they have the main groups off the data. Maybe according to the websites name. So to order panders to put the data into groups, we can tie it V one equal data dot group high and inside the brackets we won't type website , so let's run it. So we use the function called Europe I to specify the data into two groups as we have only two websites and the parameter off group high function as the website color. So pin, this is candy whips like column on the number off, different values. But it found on Lee Amazon and yell So the number off groups here is only two, and you can check the number of groups which we have a specified by typing V one dot and groups. So it appears here whether to as we have used the end up group parameter to get the number off groups. Another facility also, that you can get the index label for each group when you type V one dot groups. So Amazon takes the indices from zero till five and Yahoo starts from 6 to 11. I think that you can say these comments appear so pacing, but it won't be very helpful, went analyzing complex data. You can also detect the number off items at each group pie typing V one dot size, which means that each group have six items. Another way to clarify what each group has has to count its items using the count function . So for this late Stipe V one, don't count. So it's a clear now that Amazon Group enclosed three columns, which are date traffic number, and each column of these three columns contain six values or six rows, and also the Yahoo group contained three columns, and each of them contain six Delia's. You must know also there the off grouping as to handle and analyze each group on its own. So to access the Yellow group, for example, you can type V one, don't get Underscore Group and inside the practice we can't side, for example, yell, I think it's clear now that all the values of the website column appears with its corresponding values off the other columns as we have access here, the traffic channels off Yahoo and the number off visitor at its corresponding index label , which starts from six and 11 and also you can do the same play Xing, the Amazon Group. So let's a change Leo and the previous line and type Amazon. So it's a clear dead. This data belongs to Amazon and also its end Expro death as it starts from zero ending ETF life exactly at the original data free. But you must notes also there, if we apply any operation on the group date a frame sold. This operation will be applied on each group separately, but this concept needs an example to peak leave. So let's try this. The one dealt head and inside at two as the head function displaced, the arose from the first rose, so the 1st 2 rows is displayed here, but the Kia deadpanned this handle each a group as a separated one. So the order off accessing the fittest to Rose was applying to the Amazon Group in Yahoo Group and another way for accessing a specific number off Rose as by typing V one dealt MTH inside it. Let's type would so death message for accessing a specific road, not number off rose as we pass. The parameter was one. So it exists the second roll for each group, as we mentioned, because it consider each group as the separated data frame. So the second row for Amazon is excess and also the 2nd 1 for you. And you must notice also that the Xing here is highly positional index. So here, when we type one, it will access the second rope. Also, we can't change. We want to be too, for example, so you can notes that the third row is access off the group. Also, you must know that the grouping can be done with more than one column so supposed there. We want to include the traffic cold with the website column and the grouping operation. So, for this weekend, copy this line of code E and P said down. And now let's they'll be traffic to it and let's add a square brackets. Then we won't change the very pulse. Ooh v two. So this mean that we will have sexy groups as Anderson well corresponds to three groups which are ads, promotion and search. And also Yahoo will corresponds to three groups which are ads, promotions and search and the some of them as six. And to prove that lets type V two dealt and groups. So it's clear now that these are six groups and also to display these groups easily. We can type V two dealt count. So it appears now that we have sex groups 34 Amazon and 3 40 hours, you can now access the required number off items off these groups. When you type V two dealt head inside at one, for example, as Amazon with each group of them represents the first row or the fittest unit, and also the same was yeah, and also you can change the head value to P two, for example. So we have access now the fittest e units Amazon, with the first of three rows, represents one unit in Amazon with the 2nd 3 rows represents the second unit and the same concept with you. So in this tutorial we have explored some facilities off the grouping techniques dance for licit Oriel pink you for watching and see you next Tutorials
29. Grouping Data2: heavy putting What's up? And the Satori A woman continue talking, have held the grouping operation in PN does on the previous tutorial We have group the data piss on some exist columns off the data free But you may have a question which it did can be data p Group I Any other technique? Easily we can say yeah as data campaign groups also pie the index label whether respected the nature off the data or in other words, according to the data structure or the structure of data, we can decide to grow pi index label or not. And in our case, we can group our data directly pie making the index off with the type off hierarchical end X. But as the index off our data is off the zero positional type, so let's change it and make the website and traffic columns as the index off our data. But at first let's have a copy off our data to work on pie. This comment. So we three equal data don't copy and let's express B three. So here you can see that by using the copy function, we can access a copy off our original data and save it into a new variable. Now let's change the index by typing V three equal V three said Hungry Score index in Inside the brackets. Let's make as we mentioned, the Whip Side column and lead traffic Cohen as our new index that's good this way off. Passing, hierarchical and externally data frame give us the same result of the grouping function, which we used on the previous tutorial to make the grouping operation pace on the website and traffic columns. As here, Anderson from the Whip Side column corresponds to three values off the traffic column. Anya, who also corresponds to three, values off the traffic color but dont thinks wrong and say that the re indexing as the real step off grouping, in fact re indexing as a step used to configure data for grouping operation and the rial step off. The grouping is now by typing before equal the three. The group high inside leap rackets level equals zero. So here we have to find a very public as before and saved the group data and to it. And the grooming now is done. Pi the zero level off the hierarchical index which, as the website color and because the website column have two values Amazon and Yellow. So we can estimate that the number off groups will be too, as we learn it off the previous tutorial and to prove that lets type before don't count. Yeah, that's exactly what we estimated, as we have two groups in each group have six values. Also, you can enjoy the grouping facilities by accessing any group. So let's tie before don't get underscore group in inside it, for example, Amazon. So it seems here that this is the Amazon Group and it have six corresponds SRO, as we mentioned. Also be hierarchical index give you the ability off multi grouping as we can specify the to level off index as two groups. So let's have at pi typing the five equals v three dot group high. Inside the brackets level equal inside leap rackets, whip side and traffic. So this line means that we have a specified the values off the whip side column and also the values off the traffic column to pee the group off the new data frame. As we know of the previous tutorial, Death Amazon off the website column will corresponds to three values off the traffic column , which are promotion ads and search. And also Yahoo well corresponds to the same three values. Promotion adds answers, so the total number off groups will be six. And to check this, let's type the five dot n groups. So exactly they are six, and also we can express the structure off groping pie typing. The five don't count here, it appears with six groups, and each group has two values off the date column and two values off the number color. Finally, we can get a summary off our data by typing the $5 describe. This can give us good samarie off our data as each value off the website column corresponds to three values off the traffic cope and each value off the traffic column corresponds to two values off the number column, and here are valuable information upheld the values off number colon, as you have the means off the two values and the standard deviation, the minimum off the two values and the maximum and so on. Okay, I think that that's enough for this tutorial. Thank you for watching and see you next. Tutorials
30. Applying1: Hey, buddy Pootie, What's up? In the previous tutorial, we have completed Lee splitting or Groupings Step. And now we will start with the second step, which is applying or making some operation and to our data. So the applying or make an operation on each group can p, for example, to calculate the sum for each group. So for this purpose, we can tie the five belt egg in and saw the packets and paedo some. Here you can notes that we have used the X function, which every short cut off aggregation and passed the some parameter to end for calculating this some for each A group. As we mentioned off the Lhasa tutorial we have here sexy groups saved and the variable V five and for example, the second group, which, as promotion, has two values off the number color, so the some of them is 50. Also, the fourth group, which had the ads, have two values off the number column and the some of them. They're 35 and you must know also there. The aggregation function gives you the ability to path more than one parameter at once or, in other words, to apply more than one function. So for this weekend, type V five Don't egg inside the practice and P don't mean in the other Promet er as np duck STD, for example. So it may be for the standard deviation. Here we have calculated the mean off each group and also the standard deviation. So it appears that we have sexy groups and each group have two outputs, one for the mean value and the other for these tender division. As we passed two parameters to the aggregation function sold. That's enough for this tutorial at which we have explored the first applying technique. Thank you for watching and see you next tutorials.
31. Applying2: Hey, Vinnie, put the West's up In the previous tutorial, we have asserted on the applying operation using the aggregation function, and now we will use another tool of the applying function, which every transformation function. So for administration purpose we have defined and you did. A frame in this data frame represents some companies which manufacturers laptops with different features. So this column here represents the company's name, HP, Apple, Dell and so on. And the first column represents the number off produced laptops off the core I five category. And the second column represents the number off laptops all the core I seven category. And it's so clear that these our dummy data only for illustration and Lee Lost Colon represents the category. All the graphics card, as some of them have new video graphics card or Lena video company and the other for rather graphics card notes. Also there, the first column third value is Nan, as we will need it for illustration. Now let's make the first step, which is for splitting the data into some groups. So for this weekend, Type V to equal the one group high he and inside Ed, let's make the company as our group, and after this we can type V two. Don't count, and you can see here we have a split be data, according to the company column. So we have five groups in each group. Have three values. One at each column notes Also bed. The Dell Group have no value for the core i five column as we define it. Previously. Wedding. Then Now we are ready to use the transform function to apply the operation off the data frame groups. So let's for this type V to transform he and his slide leap rackets. Lambda Ex Colon eggs plus 10. Here we have used the Lambda Parameter, which we discussed before, so we use it as the parameter off the transformed function to add 10 to each value off the group. For example, 1006 hungry plus 10. So it appears here 1610 and you may notice also, damn the Third Cola, which and the graphics card hasn't being passed, and the reason is simply that only values all the graphics card column are string or characters, and it's not possible to and and injure value, which has 10 here to a strain value. Now let's make a confusing mistake. But we will learn an important concept off as we have a name value and our data frame. What about if we want to replace it with the main value using the transform function? It's easy. Let's type V three equal V to transform he and inside the crack it's let's type Lunda X and call him Ex Dumped, Filled Near and another practice inside at X Don't mean and let's run it Oh, you can knows that being an value hasn't peed change it and the reason that we have a slightly data into some groups and this nan value itself at the group as it has no other value on its A group. And also we can prove that from the output here, as each group has only one value and the Nan Group appears here with zero value as the only value inside it as Leen en. So when we want to calculate the mean off this group, so the mean parameter will find on Li Nen solely mean also well paying in. So this is important concept now which it that when we split their the frame. And to some groups, each operation will be applied to each group separately. So the result which we had here as the mean off the nan group Not that the mean off the whole colon, for example. Okay. I think that that's enough for this tutorial. Thank you for watching and see you next Tutorials.
32. Applying3: Haven, t 40. What's Out? And the previous tutorial. We have learned how to perform in the 1st 2 steps, all the applying on the data free and now we will learn upheld the third step, which every faltering data. Firstly, we have importantly, previous data frame off the laptops companies as all things is ready. Now let's a stirred on the filtering process. You may ask why we need to filter our data at some conventions. You may need to express or shoulder data, which have some specific facilities, or the data which meets specific standards. Another hand. You may need to cancel some data off the data frame, which doesn't meet your needs for more clarification. You can take this example off the small piece of coop, so let's tie the two equal Lambda eggs Colon X Don't cry seven. Greater than to hell, then in three hungry and then V one, the group high inside the packets we company. So we will group with the company column and then filter inside the packets V two. What we did here it that we defined the very poor V two and passed its failure to theological condition, which the values off the core I seven column, which is larger than 2000 and 300. And then we use the filter function in made its Promet er to be the logical condition. So the result is any row which has value off the crisis of in Cola, which is larger than 2000 and 300. For a clear vision, let's have another example at which we need to filter the groups according to the nan value . Or, in other words, we need to neglect the rows which have nan values. So let's type the three equal Lambda X and colon in X. Don't cry. Five duck as no don't some equal equal zero ends in V one, the group high in company. So again we will group with the company column. Don't filter in V three. Here we defined variable 33 and passed its value as the logical condition which it that to pass all values off the cry five comb which have none nan values and cancel the values off the net. So as a result, the role which have positional able to is canceled as it has Li nan value. Also, you can do the adverse which has to pass all Rose, which had nan values off the Kuroi five column in cancel rows which have none nan values off. Also the core i five cold For this. We can copy this line of cooled and peace at here and then change 32 before for V 32 p v four and then we won't remove the is no function to detect on Lee the nan values. So let's run it here we passed all values which have these some off zero and the nen Onley are the values which have zero for at some. So it appears on Lee the row which have the nan value, as we mentioned. So I hope that's clear for this tutorial at which we finish talking upheld the methods of applying operation. Thank you for watching and see you next Tutorials
33. intro to time series object: Hey, everybody, what's up in the Satori? A. We will have the very new and important topic, especially in pandas and in data signs. A general view this topic as the time serious The expression of time serious may be strange for you or efforts leave first time to hear it. I can tell you that the meaning off it easily is to express your data over a period of time or in the data science world, if you made the index off rose off your data with the time or if euros is labeled with the time. So you are now using the time serious for expressing your data for labeling it. And this can't be clear now when you have a look on the CIA's he fired. So you can't observe here at first column as the time or the date, which represents a serious off time on July. As each day off, July has its corresponding value off the mean value. So it's not important to us now the aim off this data, but I want you to have a look on the data when its label, with time or over the time here, 12 July 11 July 10 July in so on. So let's go back to our pretty cooling. At first, you must know that the very basic part off time serious is to initialized at daytime. Object as leading time is a fix a date object which you can initialize to use. Enter your good so support that you want to create a date off. For example, Day 20 in months, January and the year off work sample, tooth health and and nine. So let's simply type import it time and on the second line from time. What's date I and then on the third Lion it time and inside the brackets the 1009 but and in one and 20. So let's run it. So what we did here in these three lines of code as first lady to import the like 30 day time as we can't important the daytime function from it. And we did here on the second line when we passed the function parameters on the third line , as the parameters are the year than the month, then the day, respectively. So you can't change this arrangement off passing the parameter, but our function is called their time not date on Lee, so you can estimate that we can add more parameters to our time for this function. And let's have the hours with 15. For example, the minutes were Wendy. So let's right. So you will note that the two zeros here has p replaced was 15 for the hours and 2040 minutes. But it's important also to know bad. The dead time function is not a pan this object, but it's impeded on the python itself, and you can also detect the current local D and B time. When you type daytime, they'll know. So it's a clear Debbie Dick, now at 2000 and 18 on Marsh, then the minutes as 43 a. M. The seconds as 30 and so on, and you must know also there. The daytime function gives you the ability to access the time on Lee, not the time with the date. So for this, let's copy this line of code and adds to it time. So it seems that we have a specified the time leap by calling the time function as we type the time. Don't now duct, I So here it's the day when the hours Linley Minutes can so on. So I think that's enough for this tutorial today. Thank you for watching and see you next Tutorials.
34. time series object 1: Haven t 30. What's Up? And the previous tutorial. We took the hell the daytime object, and we use it on Lee as an entrance for our subject, as it's a limited object compared to pandas facilities for the time. Serious option as pandas is used widely in financial publications, and also it's more easier to use then the analytical languages like our it's sold. So Pandas Pedes at the time. Serious competition as Ben. This has an object inside it, which is coldly times Tim Pie, which you can't carry it at time. Object. So for this purpose, we can tie PD Duck times tan and inside that we will pass the time, which will be, for example, 2000 and nine and one and 20. So it looks like the daytime object, but it has a higher percentage in also, let's enter the time quickly pie, adding 14 and then 40 and then fight, so that's good. Right now we have other the time. And now let's try to get the local time pilot times temp object. So let's type PD don't times tamp, and we will pass the parameter web now, so it's easy also to get the current time using pen does not on Li Pi the time date object and you must know also there Another important function in pandas is the time delta which enables you to make some calculations on the time or some operations on yet. So suppose bet You know the day today and you need to get the date after two days. Then the delta function can help you when you're type now equal daytime dot now and after this we will initialize a very poor, which is after two days equal now plus pd, don't time Delta and we will said the parameter off it which as day is equal to. And then we will type after two days, which is our promise. So here, what happened? It there we initialize a very pool which is now in set at, well, a specific date, which is the current date. And then we initialize another very poor which is the date after two days in made its value will be some off B two dates. The 1st 1 is the current date or now, and the 2nd 1 is the delta function. So the barometer, which Delta function takes as the number off days and as we want to add two days to the current date So we set the days parameter Where to? So the finder result after today is which as 15 plus two days, so it will be 17. Also, you can get the difference off date between two periods by, for example, when you type first equal daytime and we will make the parameters with 2000 mine and then three and then 21. And then we will type second, equal daytime and inside the practice will decide also 2000 and nine and three and 26. So we will type now second, minus first. So here we get easily the difference between these two periods between March 21 in March 26 which has five days as appear, and the output. So I think that's enough for this tutorial today. Thank you for watching and see you next. Tutorials
35. time series object 2: Hey, everybody, what's up? And this tutorial? We will continue talking about our interesting topic, which, as be time serious now what if we want to create a serious object? But you can't say that it's a very simple thing, which we did before many times. So the new part now is to carry it serious object and past the date as its index. So at first, let's construct our pretty and simple Sears object. So let's type s equal pd dot serious and we will pass the values inside our practice. So let's, for example, type 12 and three, and then we will carry it a group off dates, which will be the new index off our series object. So let's type dates equal in inside leap rackets, PD duck times Tim and we will type the first date, which will be 2000 and nine and the month off to and the day of 15. And now let's copy this first date and peace at here, and we will change the date on Lee so it won't be 16 and we will copy it a gain and make the day with 17. So it's a clear that we have created three Pan this time objects, and now let's add them so we won't make them with the new end X for our Siri's. So let's copy this line in Peace it and let's add the dates to pee our index off our Sears . So let's type s congratulations. We have constructed just now the first time serious for the three days 15 16 and 17. And let's a check that we exactly constructed at time serious by taking a slice off the data and examined yet. So let's type type. And inside the practice, we will site s dealt antics and let's type on, for example, So the type off the second index is the timestamp off the time serious light Pretty And also, you can't define the index off a serious at the time serious, because pandas provide the ability off converting an object to a timestamp object, then to an index for our time index, and we can construct it by using the to underscore daytime function. So let's type DT underscore Index equal pd dot to underscore daytime. Inside the packets, we will type the first date which will be fit for February in 15 and then 2000 and nine, and the 2nd 1 will p none. And the 3rd 1 will P 2000 and nine 0.2 0.16 and the 3rd 1 will p 2000 and nine desh to Dash 17 and the final one will P 2000 and mine and slash in two in another, backslash in 18. So let's Taib DT underscore Bendix. Hear what happened is that we initialize very poor, which, as daytime underscore index and meet it equal to the function off to underscore daytime as its job is to convert an object to at time index. And then we passed its parameters as at time and look at the time is trained parameters as we deliberately defined the time with its difference tiles firstly fit for February 15. Then we define at time with none, which means that the value is mess. After this, we used the doctor to separate the year in month and day, and then we use the dash, and finally we use the slash and knows that the nun in the input appears with net on the output, which, as the shortcut to not a time but finally as it appears with daytime index. So we managed to do our job to convert the object to the time index. But you must know also, Deb, there is a more easier method to define the serious with the time index which can be done pie sitting the index with a range of time which has starts with a specific date and ends at a specific period which we set. So this can peek layer pie This example when we type range equal pd dot date underscore range in inside the practice We won't type the first period or the first date which will be 2000 and nine in Desh and to and 25 and the period Well, p was tense, so we will tie periods equal 10 And after this we won't Taipower serious which won't be s to equal PD duck serious. Inside the practice, we will sit our very pulse. So let's make our variables from 1 to 10 for example And then we will pass our range very pulled to it as the index and let's run it so as usual, we define a variable which is range and sit at with the date range function. And then we passed two parameters to the function, which are the initial date at which we will start the index and the number off days, which is represented in the periods parameter. So we set at Web 10. Then we define a new serious object with 10 values and set the arranged very poll as its end ICS. So as a logical result from the output, the index sisters at the date off 25 off a priority in ends at six off the month marsh as we have 10 values and also 10 corresponding time index. And after we managed to initialize the time Siri's, it's easily now to do some operation on the time Sears. So let's now revise the slicing operation pie typing slice equal s to inside the packets to and colon and flight so we won't type slice. He was started the slicing at the positional index to which as the third robe and ended at the possession All index Fife, which as the sex rope so you can also get the same result when slicing with the time index itself. So let's copy this line and change the two with its corresponding index, so it won't be 2000 and nine and desh into and 27. And also change. The Fife was its corresponding lay pope with 2000 and nine in death three and desh in one and notes depth. The index here is a strength, not an injured. So we make it on a double quotation. So here we got the same output as we estimated. And also you can do some mathematical operation on the time serious, like adding to serious object for example, pie typing as to plus slice. So it's a clear from the output there be adding operation is done under the principle off alignment between the two Sears object, which means that the rose, which has the same index, will p ended and the other rose will appears wet man's because, for example, the 25 priority has no corresponding value for the slice serious object. And on the other hand, the 27 index up the slice series object has the corresponding value on the other serious which s s too so it doesn't appear with Nan Pot. We have added the two values which as three plus three which appears here was sex. Okay, I You think that's enough for this tutorial? Thank you for watching and see you next Tutorials.
36. time series object 3: Hey, buddy, buddy, what's up? And the Satori A. We will continue handling with the time Sears so you can handle the time serious as an ordinary serious object in many aspects. So suppose you want to look up a specific value on your series so easily you can detect it whether the time index corresponding to the index as at strength. So let's, for example, detect the value off date 26. So for this we will type s too inside leap rackets 2000 and nine in slash and to and slash in 26. So here it appears with two and notes as we mentioned that we handle the index as a strength when we put at between equitation work. And also you can do slicing pie select a specific month, for example as S two has two months for priority and marsh So for this weekend type as to inside the packets 2000 and mine and three. So here we detects the values off the marsh only And now let's a change three was to So here we detected the values offer priority only. You have also Leah polity to choose the step off this playing the rose or it's called the Frequency, for example, the step off what we displayed world the day. So if we started at 25 each of step won't Pete Weather date so 26 27 29 so on. But we have the ability to change this step or frequency by using the frequency parameter as if we set at West E, for example, it will display each minute. And if we said it was be so, the frequency will be the business day, which means that the holidays will be cancelled. So let's try it. So let's copy our Sears or our time serious. And now we won't change the index or we won't type at with these second methods. So we will tie pd dot date underscore range. Inside the packets, we will start at 2000 and nine and the mouth off too. And the day off 25 and we will end at 2000 and mine and the month off Marsh and the day off tip and we will made the frequency as we mentioned West Pete So Greek equal p and we will change s two to PS three. So Let's run it here. Look at the output as it's clear that the day is 28 off a priority and one off marsh, both of them has been cancelled as they are the holidays. Also, the frequency has many values which can be set like deadly for the week and the help. It won't be each a starting day off each week or the day, which comes after the holiday, which as the Sunday as the holiday as Saturday. So let's try it by changing the West Death Lou. But before running these two lines, we need to decrease the values to pee on Lee to values, as the output days will be on Lee two days, as we have on Lee, two weeks off our days or off our series. So we will decrease them to pee on Lee one and two, and let's run it So it appears off the output that they are day one off March and eight off Marsh, as both of them are. These 13 off the two weeks. Also, you can make it with the month in, so it won't display on Lee the month in. So let's a change lead a plea to PM and as the output value will be only one value. So let's relate this to so let's run it now. Exactly, it appears with Onley 20. It's a priority, which as the end off the priority. Okay, that's good right now. And you must know also that the time serious power in pandas lays under its many useful tools. One of these tools or objects is called the Time Officer, which, as at fix a time, we can set to use it and timing operation. So, Paul that we need to increase our current date with a day or when, two months, for example. So that's fix a day or these fixes two months as the time offset which we will use. So let's try it by typing date equal day time inside the packets. 2000 and nine in two and the day off 26. And after this, we will initialize and you very pull, which is offset and make it equal to P D dot date offs. It and we will make its pram Attar's, which is day is equal to what and now let's make the operation off, adding the date well, the offset. So here what happened at that? We initialize at daytime as usual and then initialize date offset, which is our very poll here and make it equal to the date offset function and pass the parameter off the function with one day. And finally we added the initial date to the date offset. So 26 plus one well p 27. Also, you can enjoy the date offset facilities to calculate the next business day. But as we want to use the business day function so we will import the office it like pretty So we won't type from pandas Don't time Sears duck offsets import and store And after this we will import our line of code, which is date plus business day. So here we increased the current date with one day as it was 26 spots here it's 27 also you can detect the lost business day off the month pie. This line of good So let's type date plus P month end here as security has 28 days and the lost business, they s 27. So here it appears, with 27 as the month end as the lost business state and you can get also the end of the month pie this line. So let's type be month end. Don't roll forward. Inside the packets we will side daytime and the day 12 p 2000 and nine and three for the month and 26. So here we used to functions. The 1st 1 is the month in and the 2nd 1 is b roll forward to specify the moving direction as we want to move forward. So here we used to functions. The 1st 1 is the month in and the 2nd 1 is the roll forward that specified the moving direction as we want to get the end off the current month and note also that here we got the end off the months, not the lost business date. So I hope that's a clear right now. So this is for this tutorial today. Thank you for watching and see you next. Tutorials