Basic grouping in pandas

Поділитися
Вставка
  • Опубліковано 11 січ 2025

КОМЕНТАРІ •

  • @veganath
    @veganath 2 роки тому +2

    Probably the most under viewed tutorial, thank you sir. Thumbs up & subbed

  • @uptronstudio
    @uptronstudio Рік тому +1

    Thanks for this Reuven. Is it possible to use groupby and at the same time display all the affected rows?

    • @ReuvenLerner
      @ReuvenLerner  Рік тому

      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!

  • @saiful305
    @saiful305 2 роки тому +1

    How I should sort "How many trips are occurred per month?" and "Which hour of the day had the most frequent trips?"

    • @ReuvenLerner
      @ReuvenLerner  2 роки тому

      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?

    • @saiful305
      @saiful305 2 роки тому +1

      @@ReuvenLerner I am trying to do that. Thanks. 😁

  • @_truthful_q_
    @_truthful_q_ 2 роки тому +1

    One of those jems (Reuven that is) - you look at the clock and wonder where the time went, if you know you know 😉

    • @ReuvenLerner
      @ReuvenLerner  2 роки тому

      Thanks so much, delighted to know you're enjoying!

  • @loli2141
    @loli2141 Рік тому +1

    THANKS

  • @akrm3240
    @akrm3240 2 роки тому +1

    Thank you so much!

  • @omprakashreddy4230
    @omprakashreddy4230 2 роки тому +1

    Simply WOW !!

  • @dkibe6006
    @dkibe6006 Рік тому +1

    wooow! amazing