Understanding Transform Function in Pandas | #31 of 53: The Complete Pandas Course

preview_player
Показать описание


-----------------------------------------

While building a ML model, you use different Data sets. Here Transform is an another method which helps you to perform the task in more efficiently. In previous videos we have learned about Group By. Now it is very essential to learn about Transform method too.

Join ML+ membership for exclusive Data science content

🔹 Why Transform Method in Pandas is being used by Data Scientist?

So far with grouping we have seen how to use the add method, first you do a group by and then you use the add method, you can also use the apply method. Now, in this one we will see one more additional method very useful that is called the transform method.

Now, the difference between these two methods and transformers on looing add as well as apply the resulting data frame will contain unique values of the class. So, in our previous cases, we saw for our P class, the output always contain unique values of one two and three this was this was always the output and this can be either the mean of the fair or survived whatever it is, this was how our output was.

Whereas, in transform method, what it does is instead of aggregating, it does not aggregate it will create a entirely new column in your data frame. How that column is computed is for example, say this is this column is our mean fair average fare right this is our average fare three different unique values.

If you are using transform and computing the average fare what it will return us, it will give the entire column instead of having unique values of your P class, it will have as many rows as the number of rows in your data frame.

And in places where one is present, this will contain the mean fat in all places, where one is present, it will contain the mean fare of that particular class like this particular value. Likewise, wherever two is present, it will contain this particular value, wherever three is present, which will contain this particular value.

#machinelearningplus #python #pandasdatascience

Let me know in the comments section if you have any questions!

🤝 Like, Share, Subscribe for more!

Follow us on our social media handles for all updates, events and live sessions-

If you enjoyed this video, be sure to throw it a like and make sure to subscribe to not miss any future videos!

Thanks for watching!
Рекомендации по теме
Комментарии
Автор

Thanks brother, I understood so easily

SAI_LINGESH
Автор

please remove the thumbnail feature at the end of your videos. what's the use of it if last 20 seconds content are not able to seen.

rksps