Data FILTERING in Pandas via Boolean Indexing - tutorial #3

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 ก.ย. 2024
  • This video is containing data filtering with the boolean indexing approach in pandas (python).
    Dataset: www.kaggle.com...
    #Python #Pandas #DataScience

ความคิดเห็น • 22

  • @xsdash
    @xsdash 2 ปีที่แล้ว +3

    Keep on making these videos, i can't stop watching videos of your channel. lol

    • @Algovibes
      @Algovibes  2 ปีที่แล้ว +1

      Thanks for your support mate

  • @farooqhusain5534
    @farooqhusain5534 2 ปีที่แล้ว +1

    Excellent video

    • @Algovibes
      @Algovibes  2 ปีที่แล้ว

      Thank you mate

  • @NostraDavid2
    @NostraDavid2 2 ปีที่แล้ว +2

    "order of operation" is why you need extra parentheses with the & and | operator.
    So called 'bit-wise' operators are always executed 'greedily', which means they try to execute before the >= operator, messing up what you mean.
    I recommend looking into "order of operation" if you're confused (it *is* a pretty complex, but also important, topic).

  • @mr.harrow222
    @mr.harrow222 3 ปีที่แล้ว +1

    Thank you very much!

  • @jives.
    @jives. 3 ปีที่แล้ว +1

    thank you for this!

    • @Algovibes
      @Algovibes  3 ปีที่แล้ว

      You are very welcome :-) Thank you for watching.

  • @ViNguyen-fj5ui
    @ViNguyen-fj5ui 3 ปีที่แล้ว +1

    It's very clear and helpful. Thanks a lot.

    • @Algovibes
      @Algovibes  3 ปีที่แล้ว

      Thanks for watching mate :-)

  • @memo12117
    @memo12117 2 ปีที่แล้ว +1

    Hi , thank you , i am new in programming , can i ask you how can i get if the last value in one column is the greatest one in comparing with last 10 values in the same column ?!

  • @cypherecon5989
    @cypherecon5989 2 ปีที่แล้ว +1

    If I try do filte the data by df[(boolean-mask)] the table gives me only NaN as values, why is that?

    • @Algovibes
      @Algovibes  2 ปีที่แล้ว

      Depends on what are you filtering for?

  • @siddhantkasar4512
    @siddhantkasar4512 6 หลายเดือนก่อน

    '>' not supported between instances of 'list' and 'int'
    this error found

  • @cypherecon5989
    @cypherecon5989 2 ปีที่แล้ว +1

    What is the problem if the mean() function returns the value "inf"?:

    • @cypherecon5989
      @cypherecon5989 2 ปีที่แล้ว +1

      my values werent integers / floats :D

    • @Algovibes
      @Algovibes  2 ปีที่แล้ว

      Nice that you solved it on your own 😛

  • @mahimapereira8531
    @mahimapereira8531 2 ปีที่แล้ว +1

    I tried this and the code is correct but Im constantly getting a keyerror. Pls help

    • @Algovibes
      @Algovibes  2 ปีที่แล้ว

      Can you elaborate when you are getting an error? Happy to help!

  • @assafcohen3173
    @assafcohen3173 2 ปีที่แล้ว +1

    Thank you for this, I am watching the entire series.
    I have a question, if I want to search for cereal with high protein or low fat but only want to display their name I can do something like this: df[(df['protein'] >= 4) | (df['fat'] < 2)].loc[0:,'name']
    This command returns a series. I could not see how I can display it as a dataframe, any idea?

    • @Algovibes
      @Algovibes  2 ปีที่แล้ว +1

      Hey man, thanks a lot for watching. The easiest way would just be to transform the series into a data frame.
      define the series -> series = df[(df['protein'] >= 4) | (df['fat'] < 2)].loc[0:,'name']
      Then
      series = pd.DataFrame(series)

    • @jeanhubert250
      @jeanhubert250 2 ปีที่แล้ว

      ​@@Algovibes Or you could just put brackets as see on previous videos :
      df[(df['protein'] >= 4) | (df['fat'] < 2)].loc[0:,['name']]
      Brackets makes it DataFrame, whithout it makes it Series. Am I right ?