 Hello, welcome to SSUniTeX to see this side and this is continuation of PySpark tutorial. So in this video we are going to see about the length and trim function in PySpark. As per the today's agenda, first we will see about the length function then we will see about the trim function and where we can use these two functions in the real time we will see in this video. So what length function will do, length function will be going to calculate the total length of any string and trim function will use to remove the extra white spaces which is available at the starting and at the end of the string. So let me quickly go inside the browser and we'll try to see in practical. I'm going to create this data frame and this data frame is having two columns with the ID and name. So if you can execute this script then it will be creating the data frame DF and we'll be generating two columns with the values of three rows. So it is executing. We can see running command. Alright, so this is created as you can see here. We are having this to seal and before that we have two spaces and at last we have few spaces. So how we can check that? So we simply go here in the DF dot here we can use the with the column function and in the column function I'm going to add a new column which is the length and we can use the length function here and in this length function we can simply pass DF dot name. So we just want to calculate the length of this name and let me put this in another data frame DF1 and at last I'm going to display this DF1. Let me execute it. So it will be adding one more additional column here. Okay, it is saying this alien not available because we have to type the full name and this length we have to import. So we can import from the PySpark dot SQL library on PySpark dot SQL dot functions. I'm going to import all the function and let me try to execute. So we will be going to see one additional column will be added and the length we can see 15 2014. So it is going to calculate how many characters are available in this string. So that is the length. Next I'm going to add one more column here. So for adding one more column, we can again use the with column function here. What I'm going to do, I'm going to trim. So trim function will help us to trim the white spaces those are available in the name column. So we can simply use DF dot name here. Now let me try to execute it. So this time it will add one more column and here the white spaces are gone that we can see we don't have any white spaces at the starting at at the end how we can verify this. So let me try to add one more column here and we can use with column and inside that I'm going to use one more column with the trim length common and here we need to write the expression. So I just want to take the length of this trim the column so we can first trim it and after that we can get the length. Like this. So what this will do, it will be going to trim on your name column and after that it will be calculating the total length. So now let me try to execute it. So we will see the output here. So now we can see total 13 earlier the length was 15. So two white spaces were available at the starting. Similarly here we can see 19 because one white space is available at the last. Similarly for this web hosting we can see one white space is available at the last. So that we have removed and after that we can see the total length of that. So this is the way by which we can use the trim function if we are having any white spaces and we can also use the length function to check the length of any particular string. So I hope guys you have understood how we can use the trim function and the length function. Thank you so much for watching this video. See you in the next video.