Hello, guys, and welcome back to another class of our course about the complete introduction to that
assigns.
So in this class, we are still talking about pendas operations and we are going to learn a basic pande
operation that is called slicing.
So be able to be able to explain to you what exactly is slicing.
I'm going to present it by the use of this little database.
So the database that we worked with a little bit before in this course, so pretty simple.
Let's say you guys have your database right here.
So you have your small database, but you only want the two first elements right there.
So there is a way or there is a function that you guys can use with Banda's and Python to be able to
only generate the two first rows, or if, for example, you want the tree, only the last word or only
the four less rules.
So basically there is an operation in Python that you guys can use to be able to only generate some
rules, but not all the rules from your database.
And this function is called head or tail.
So you'll see it's pretty simple.
So right here we have our database, as you can see, the exact same database that we wrote so we can
write down table one right here to be able to run our database.
So as you can see, we have our database that works perfectly.
So what we want to do right now is pretty simple.
So we're just going to add a little dot and we'll write down head.
So what what we want right now, we want to generate the three first elements inside of this database.
So basically we want to generate Abidjan and leave them.
So how exactly will do this?
Pretty simple.
We just write down the head and then we enter the number of rows inside of the parenthesis.
So let's say one, the three first rows.
So in this case, it's going to be three and we run our up.
So as you can see, we have the three first rows that have been generated.
So we have about John and llena, if we only won the first row, so we'll do the exact same thing.
So we'll just write down one so we'll only generate it.
All right.
So let's say right now we want to generate the last row, so we want to start generating from the employee
number five.
So in this case, we are going to use another function that is called tail.
So we will write down the exact same thing.
So we have our database will print our table, but we'll write down Dutil.
And in this case, we want to generate which.
So let's say we want to generate only the fifth row.
So write down, tell and in the parenthesis.
Right one.
So basically, it's going to simply start calculating from the down.
So from the letter, from the last one.
So tail will start with learning from the last one and had we'll start calculating from the first one.
So let's say we write down tail and we write down three is going to generate the three less.
So in this case it's going to be llena, Mark and Bob.
So I think you guys get the point.
So basically, if you want to generate the first elements of your database, you simply use head.
So let's try it out.
We write down head and we run our up.
And if we if you guys want to you to to generate the last elements of your radar base, it's going to
be tail.
So basically same thing, but just right down to it, you can run your app.
And as you can see, it's going to generate the three last elements of your database.
Right.
So that's at first glance.
Guys, I hope you have learned a new function of pandas as well as Biton.
And see you all in our next class where we are still going to talk about pandas.