Python pandas — Grouping Exercises — Regiment

preview_player
Показать описание
Sometimes we learn best by doing. Unlike my other videos, I’ll be going through these exercises cold. Sometimes we’ll encounter ambiguous questions, and sometimes I'll be wrong. Learning from our mistakes can be a powerful teacher. So, it’s OK to be wrong now, because we’ll know how to avoid it next time when it counts. My hope is that you will learn by doing. Why don’t you proceed through the linked exercises before we walk through them together? This series can be viewed in tandem with my “An Opinionated Guide to pandas“ video series (links below), but it’s not required. This series is beginner-friendly but aimed most directly at intermediate users.

This Learning by Doing is part of the pandas indexing and selecting:

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

thank you for posting good content from a data science undergrad

psreotu
Автор

Things I learned from this lecture

df.groupby('a')['b'].size()
Groupby object can be unpacked by iterating them using for loops

arhataria
Автор

On the last question iterating with .loc over uniques:
9.89 µs ± 30 ns per loop
iterating over groups like in the solution:
48.3 µs ± 2.07 µs per loop
🤷

icanfast
Автор

What is the number of observations in each regiment and company?
reg_comps.size()

What is the number of observations in each regiment?

jimmymesa