Hello and welcome to Deterred by tinted ordeal on data frames he had with Villone multi index and index
hierarchy.
Let us begin first import deliberated.
Great after that, define a least outside.
InterCloud read two more times.
Then enter color green three times.
They find one more liste inside.
One, two, three, again, one, two, three.
Execute.
Great.
Now define a variable.
Higher index in this variable.
We're going to store a list in that list, zip function.
And deep barometers outside and inside.
Execute.
Now, take this variable here.
Index.
Great.
So this is a list of people's.
Using that stuffed up, well, today will define a multi index, define a variable multi index is equal
to BD Dot Multi Index.
Dort from double's.
Inter barometer as higher index.
Then one more parameter names.
Gullahs.
And number.
Now, take this multi index.
Great.
So this is the multi index that we have defined here.
Now using that multi index, define a data frame.
B, F, bd dot data frame.
First, we have to specify the data.
Data is equal to that end and.
And in parentheses, six comma, two six rows and two columns after that specify.
Index.
Index is equal to multi index.
And at the unspecified columns.
A and B.
Now, take this data out from the F.
Great.
So this is a multi index data frame.
This is the index level one.
This one, the red and green, this column.
And this is the index level.
Second one, two, three, one, two, three.
Let us understand how we how defined a multi-level data frame.
Scroll up.
First view, how important the libraries.
After that, we help, we find to list outside and inside.
Then using this list to be how do we find a variable?
Higher index.
This one, a list of doubles.
And using this list of doubles, we have defined multi index.
And Vedette Multi Index, we have defined a data frame.
Be index data, frame this one, index level one and index level two.
And this is data data.
In column A and B, let us understand how to call the data from multi index data frame.
By the name of data frame B, F dot a low, C specify index.
Read.
So this is the output here.
We have specified level one index that is read.
And this is the output in level one index grade.
There is level two index.
And this data, let us understand how to select level two index type dot Alosi.
Specify indexed level to execute.
Great.
So this is the data from index level to to get that data.
We have to specify.
Index level one.
And then we have to specify index level to like these.
And after that, we can grab a column.
Also column A.
Great.
So this is how we can call the data from multi index data frame.
Let us see one more example.
The F Dot LLC.
Index level one is green.
Great Dane Dart, LLC.
We will grab these two.
So this is the output from index level one and index level two.
Now grab the data from Colombe.
Zero point seven for this one.
So this is all about grabbing data.
No check.
The index stays in this data frame.
The F dot index dot names.
Colors and numbers.
These two are the indexes.
We can change these indexes.
Let us see how Kopit is based.
Is equal to specify a list.
C o.
L.
That is four color and.
And you.
And that is four numbers.
Take the data from D.F..
Great.
So here we have successfully changed the index's call and name.
Previously it was colors and numbers.
So this way we can change the indexes.
Let us understand a function for might be index cross section.
Take the data out for him.
B f.
So this is our data frame to grab the level one index trade.
We use a Locy method like this.
B.
F dot.
A, Locy.
And then index level one read.
And this is the output.
We can do the same with cross-section function type D.F. dot X s and in parentheses index name read.
Same output.
So this is the cross-section function in cross-section function.
We can't specify other parameters.
Also.
Let us see how.
So these are the parameters that we can specify key axes, level and drop level, specify key is equal
to one.
And level is equal to number.
Execute.
Great.
So this is the output.
Let us understand this output.
We have specified key is equal to one.
This one Vun.
In the data frame we have given is two times in index grade and in index green.
And after that we have specified the level of this key, which is now.
Key and level, and this is the output.
So here we have selected all the data under key one and level number so we can say that the cross-section
function has the ability to go inside the multi level index.
As you can see here at a time, we have selected all the data from Key VUN.
This is the ability to go inside the multi level index.
In this tutorial, we have learned a lot of things.
Let us vides.
Data frames part three.
First, we have defined a multi level index.
This one.
And we have defined this multi level index from a list of double's.
After that, we have defined a data frame, multi-level data frame this one.
There are two levels in this data frame, level one and level two.
And after that, we help understood how to grab the data from multi level data frame.
To do that, we use this method.
Doc Alosi method, then we help understood how to change the indexes.
And at the end, V.L. understood cross-section function.
This one dot, it's as so despite Antigo deal on data frames, part three NCEA.
I will see you in the next one.
buildOn Happy learning.