Boolean indexing in Pandas made simple

preview_player
Показать описание
Boolean indexing (aka mask indexing) is the main way that we retrieve values in Pandas. But to many people, it looks and feels both weird and unintuitive. In this video, I show you how it works and how to think about it, both with series and data frames. You'll finally understand boolean indexing, and be able to use it in your owrk!
Рекомендации по теме
Комментарии
Автор

I have seen multiple videos of pandas filtering and indexing but none of them explained how actually giving a list of booleans works on a DataFrame. Thank u.

RAJACENA
Автор

You did a really good job explaining this.

arjunpsk
Автор

Great Video. Scenario for you. I will try to describe how i get there and the question is how do I get the index's of the rows that are all true. So have an excel, i create dataframe of certain channel numbers. In this one has 8 columns and 48 rows. Not every row has a number value and every row does have a nan. i write ```isTrue = df.loc[0:48].isnull(); print(isTrue.head)``` gives me what i am looking for. A DataFrame of T/F in 48 rows. Now there are some rows that have 8 True's. Telling me that there was no number value in that row.I am Trying to figure out a mask that will tell me the index of the row with 8 True's. And 8 just happens to be the number this time. But thats beyond what I am after here. Is there any guidance that you can send me looking to get what I am after? Thank you for your time.

speedyg