Top Five Tricks for Coding in Pandas - with Matt Harrison

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

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

  • @alwayz247
    @alwayz247 8 месяцев назад +2

    I'm a R tidyverse user who switched to Python. I've been chaining most of my pandas expressions because that comes natural to me (as a tidyverse user). I chain it without the parenthesis, but rather use backslash to go to new line. It has pros and cons. The main pro is I can select partial code and run it in VSCode interactive similar to that in R. It's still not a replacement for R but it's close. It looks like this:
    df\
    .assign(value2 = lambda df_: df_['value']**2)\
    .groupby('type')\
    .agg(value2_sum = ('value2', 'sum'))\
    .reset_index()
    I can select the code upto and including the first assign, run that first, check the results, and then run the rest. In this case, it's a trivial code. But in a complex chain, this can be very helpful.

  • @mabenba
    @mabenba 2 года назад +7

    Amazing clip. I love the idea of chainning that Matt presented. I come from R as well and it truly feels like piping.

    • @JonKrohnLearns
      @JonKrohnLearns 2 года назад +2

      Likewise! It makes the code so easy to read and understand.

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

    Amazing! My two favorite internet teachers !!

  • @BrokenRecord-i7q
    @BrokenRecord-i7q 8 месяцев назад

    Chaining is a great tip :)

  • @sitrakaforler8696
    @sitrakaforler8696 Год назад

    cool tricks !

  • @CaribouDataScience
    @CaribouDataScience 2 года назад +5

    The number on trick.. switch to R and tidyverse :)

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

    11:10 pandas has a nice .pipe method

  • @jbj926
    @jbj926 Год назад

    Chaining isn’t that deep. So much exaggerations going on in the first half of the video. I chain when it make sense and don’t when it doesn’t matter which is basically all the time for all of data science.

    • @JonKrohnLearns
      @JonKrohnLearns Год назад

      Great that that's your opinion and experience! However, my opinion and experience is in line with the level of enthusiasm I have for chaining - as far as I'm concerned, I was not exaggerating :)

    • @jbj926
      @jbj926 Год назад +1

      @@JonKrohnLearns my fault. You weren’t exaggerating. I now regret even saying anything because you’ve been a good steward for DS. Matt, however, imo is trying too hard to push changing. Clearly it has use cases but it’s not the end of the world if someone does not chain.

    • @JonKrohnLearns
      @JonKrohnLearns Год назад

      @@jbj926 yeah, fair enough!

  • @peeintea
    @peeintea 2 года назад +3

    Intro is terrible, way too loud and the sound is annoying. Please change it.
    But the conversation is great.

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

      Ah damn, that's too bad, Jurek - I love it and think it's super slick (I was not involved in the creation of it in any way; I just think it's really awesome)! I don't think we'll be getting rid of it. Would love to hear others' opinions on this though!

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

      @@JonKrohnLearns I found this insightful. I had no problems with either the intro or sound. Thanks Jon!

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

      @@indus2059 delighted to hear it :)

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

      @@stanshelton4592 yeah, what are your thoughts on it?

    • @Kinnoshachi
      @Kinnoshachi 2 года назад +2

      @@JonKrohnLearns just need to normalize the volume of the intro, it’s a bit loud, or it’s fine because if the listener is too annoyed by the 3 sec intro they may be less likely to stay and or learn anyways, however if the listener was sleepy like me it would jolt them to attention and they would be more ready to learn 😂

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

    Good stuff. The guest says "parenthese" for the singular form of parentheses when in fact, the correct form is parenthesis. He might have missed that point in elementary school.

    • @skf957
      @skf957 Год назад +4

      Karen: noun, M or F