 Hello, welcome to SSUnitex within this site and this is continuation of PySpark tutorial. So in this video we are going to see about the sort and order by. So when we can use the sort and order by we will see in this video. So that today's azinda is first we will see about the sort and then we will see the order by clause. So either we can use the sort or the order by function so both are same. Either we can go with the sort or we can go with the order by. So we can sort any data frame by ascending or descending order. So let me quickly go inside the browser and we will try to see in practical. So here we have this data frame that is DF so it is reading the data from the csv file and it is having the sales information. Now let me try to sort this data frame from quantity. So use the DF dot then we have to use the sort and inside the bracket we have to specify the columns. So we just want to do the sorting on the quantity and let me put this in another data frame and let me check with the display command this data frame let me execute and we will see the output of this. We can see it has been sorted into ascending order the quantity 2 then we have 3 then 4 values like that. Now here this is the first way by which we can do the sorting the second way we can also use the order by. So let me try to use the order by instead of this sort. So let me execute and we will see the output of this that will be same as we can see the quantity has been in sorted order now. So either we can go with the sort or we can go with the order by the second way by which we can also sort this here if you want to sort this into any ascending or descending order then this will not work. So how you can specify the quantity you have to either go with the DF dot quantity then you can specify in descending order like this. So it will work let me execute and we will see the output. So if explicitly you are going to specify ascending or descending then you have to go either with the data frame and column name then the ascending or descending order or you have another way by which we can do the sorting that is if we don't want to specify data frame here then we have to make this column as call function. So we have to use the call function and making this quantity as a column but this call function directly will not be available. So what you have to do you have to import this call function. So pyspark dot sequel dot functions then import this call function and let me try to execute and we will see. So we should be getting the same output as it is in sorted order. So till now we are good. Next if we just want to do the sorting first based on the quantity and second based on the value then how you can do the sorting. So here we can use the first column as quantity and second column we can specify as an value. So we can go with the value dot here I am going to with the descending order you can also specify the ascending order maybe. So either way you can use it. Let me execute and we will see. So it should be going to sorted as we can see it has been sorted and we can see the value is in ascending order. So these are the different way by which you can do the sorting on the data frame. So I am especially using the last one which is the df dot column name dot ascending or descending order you can either use this one or you can go with the call function because call function we have to explicitly import here. So that's why I am not going to use this very often. I am going to use the last one. So I hope guys you have understood how you can use the order by and sort function inside the PySpark. So thank you so much for watching this video. If you like this video please subscribe our channel to get many more videos. See you in the next video.