Pandas Dataframe Index & Selecting Data | Python Pandas Tutorial #2 | iloc loc isin Pandas Function

Поделиться
HTML-код
  • Опубликовано: 27 окт 2024

Комментарии • 24

  • @aliefe9722
    @aliefe9722 2 года назад

    I have to admit it was way beyond what I expected... Thanks...

  • @Alias.Nicht.Verfügbar
    @Alias.Nicht.Verfügbar Месяц назад +1

    thanks a lot!

  • @the-ghost-in-the-machine1108
    @the-ghost-in-the-machine1108 Год назад +1

    excellent!

  • @elfridhasman4181
    @elfridhasman4181 2 года назад +1

    Thank You Very Much :)

    • @datagy
      @datagy  2 года назад

      Thanks Elfrid! :)

  • @jonathanfriz4410
    @jonathanfriz4410 3 года назад +1

    Hey very good video, thanks you. One question the isin is use for exact matches is there a way for match partial coincidences? using your example you put 'Health', Biology', 'Life Science', suppose the data frame contains some bad words like 'Life.Science' or two category that contains 'Life' in it how would you do that? like the filter option in excel. Thanks!

    • @datagy
      @datagy  3 года назад

      Hi Jonathan! Glad you found it useful. Great question!
      For this purpose, you can use the .str.contains() method. You can use regex to account for capitalization, or you can convert the column to lower case. So for example, you could write:
      df[df['column_name'].str.lower().str.contains('health\biology|life')]
      This would search for any rows containing health, biology or life.
      Hope this helps!
      Nik

    • @jonathanfriz4410
      @jonathanfriz4410 3 года назад +1

      ​@@datagy Helps a lot, in fact I did that, but use the 'health' | 'biology' not all in one string that was my big mistake that i couldn't figure it out and you solved like that. Much appreciated Nik!!!

    • @datagy
      @datagy  3 года назад

      Happy to help! Glad it’s working :)

  • @majddabour97
    @majddabour97 4 года назад +1

    God Bless u, Keep up buddy ♥

    • @datagy
      @datagy  4 года назад

      Thanks! Glad you enjoyed it!

  • @fabio336ful
    @fabio336ful 3 года назад +1

    Cool

  • @Roma_Wasilenko
    @Roma_Wasilenko 4 года назад +1

    Chalenge answer is df[(df["Major_category"].isin("Biology and Science", "Health")) & (df["WomenShare"] > 0.5) ]. Right?

    • @datagy
      @datagy  4 года назад

      Thanks for your comment! You're very close: You'll want to wrap the .isin() parameter as a list:
      df[(df["Major_category"].isin(["Biology and Science", "Health"])) & (df["ShareWomen"] > 0.5) ]

  • @rinsyarifuddin8696
    @rinsyarifuddin8696 4 года назад +1

    Where we get the dataset ?

    • @datagy
      @datagy  4 года назад

      Hey Rin! You can download it here: github.com/fivethirtyeight/data/raw/master/college-majors/women-stem.csv

  • @laminesahraoui9548
    @laminesahraoui9548 8 месяцев назад

    thanks

  • @MrBabcast
    @MrBabcast 13 минут назад

    The content is great, the vocal fry on the other hand, just keep me distracted...

  • @monacojay
    @monacojay 3 года назад +1

    Your videos are really helping me! - I tried to shoot you an email but nik@datagy.io returned an error, just a heads up

    • @datagy
      @datagy  3 года назад

      Ah thank you! I’ll fix that shortly. Nik@datagy.ca should work.