Remember that groupby is for aggregation, which generally speaking means that a function takes a lot of values as an input, and returns one value as an output. For example, mean is an aggregation method; run it on a series, and you get back a single (numeric) value. The point of groupby is to call an aggregation function repeatedly on a data frame, once for each categorical value in a particular column. You'll thus get back one value from the aggregation function for each of the categorical values. All rows are affected by the groupby; the grouping doesn't do any filtering, but rather calls an aggregation function on each row. I'm thus not quite sure what it would mean to display affected rows. If you can give me a more specific, concrete example, I'll gladly try to help!
For the first, you would group on the month, and use the count method. For the second, you could group on the hour, and use count - then sort by the values. Does that make sense?
Probably the most under viewed tutorial, thank you sir. Thumbs up & subbed
Happy to know you enjoyed it!
Thanks for this Reuven. Is it possible to use groupby and at the same time display all the affected rows?
Remember that groupby is for aggregation, which generally speaking means that a function takes a lot of values as an input, and returns one value as an output. For example, mean is an aggregation method; run it on a series, and you get back a single (numeric) value.
The point of groupby is to call an aggregation function repeatedly on a data frame, once for each categorical value in a particular column. You'll thus get back one value from the aggregation function for each of the categorical values.
All rows are affected by the groupby; the grouping doesn't do any filtering, but rather calls an aggregation function on each row. I'm thus not quite sure what it would mean to display affected rows.
If you can give me a more specific, concrete example, I'll gladly try to help!
How I should sort "How many trips are occurred per month?" and "Which hour of the day had the most frequent trips?"
For the first, you would group on the month, and use the count method. For the second, you could group on the hour, and use count - then sort by the values.
Does that make sense?
@@ReuvenLerner I am trying to do that. Thanks. 😁
One of those jems (Reuven that is) - you look at the clock and wonder where the time went, if you know you know 😉
Thanks so much, delighted to know you're enjoying!
THANKS
My pleasure!
Thank you so much!
My pleasure!
Simply WOW !!
Delighted you enjoyed it!
wooow! amazing
Glad you enjoyed it!