Hello, everyone, and welcome to this bitin tutorial here we will understand group by method.
Let us begin.
We use group by method to line up the data together and call aggregate functions on that.
In simple words, we can say that group by function allows us to group together rules based on columns.
And after that, we can perform aggregate operations first import the library reads.
Import numpty as ENPI.
Then import Bendat.
As beedi execute.
Do understand a group by function B, how to define a data frame.
And we will define this data frame on the basis of a dictionary.
So define a dictionary.
First name of the dictionary is deemed data.
Putting the key company.
Then valued as at least.
Apple.
Facebook.
Then Google.
And one more time, Google.
No passing one more key.
Person, this is also a list.
Mark.
Dom, John.
Sara, Mia and Emma.
No.
Add one more key value pair key ad sales, then add at least two hundred, 150, 350, 120 for you do
60 180.
That seat execute.
Check this dictionary team data.
Great, in this dictionary, there are three key value pairs.
These are the keys.
And these are the values.
Now, define a data frame.
B.
F.
BD dot data frame.
Specified team data.
Execute.
No, Jake, this data frame the F.
Great, in this data frame, there are three columns and six roads.
No, we can understand the group by function.
Have the name of data from the EFF F, then group by function, specify parameter by.
Bike company.
So this is the group by object.
And it is pointing towards me, Muddy, to get the actual output store.
This is a variable.
Variable be.
Now take BEE and apply aggregate function.
I will apply mean.
So this is the output data.
It's aggregated here.
Total Apple sales, total Facebook sales and total Google sales.
We can apply other aggregate functions.
Also.
Type variable B, now use some.
This is the output.
Let's see one more aggregate function.
SDD, this is for standard deviation.
Great.
We can apply this function for a specific company.
Also, let us see how.
A variable, B, not aggregate function some then dot a low, C, specify a company, Apple.
So this is the output for this specific company.
Apple sales 350.
We can do all these operations in one lane.
Also, let us see how the name of the data framed D.F. then grew by function grew by.
On the basis of company.
He added, We can use aggregate function some.
Execute.
So this is the result we can add.
Company name also.
F b..
So this is a very adult.
So this way we can perform all the operations in one lane.
Also.
Let us see other aggregate functions.
B, dot count.
This function returns the count.
There are two person in Apple, two in FBI and two in Google.
And there are total two to two values of sales.
Baby Dot Max.
So these are the maximum values of each company.
And these are deep person names.
In similar vein, we can apply in function, be dort mean.
These are the minimum values of taels for each company.
Let us understand one more function with group by method.
Group by method describe.
First to use.
Group by method.
B f dot.
Group by
barometer by is equal to company.
Then God describe.
So this is the output in this output v. count mean standard deviation, minimum value, first quartile,
second quartile, third quartile and maximum values.
We can get transfers of that.
Let us see how.
Based dot dance booths.
So this is the transports.
So these are the values cound mean standard deviation minimum.
These are the three quartiles first, second and third, and then maximum values we can use to describe
function on the basis of a single company.
Also, let us see how Paiste then Dot Alosi enter name of the company.
And this is our output.
All the values on the basis of company F B, so despite and ditto the NCA.
Let us revise what we have learned in this ordeal.
First, we have defined A data frame B F and we have defined this data frame on the basis of a dictionary.
This one.
After that, we help understood aggregate functions with group by function.
This is our first aggregate function mean.
Then we help understood some standard deviation and other functions like Cound, Max and Min.
And at the end, V.L. understood group by method with described function described function returns.
All these values.
So this patented Odille Ungrouped by Method NCEA.
I will see you in the next one, will then.
Happy learning.