4 Pandas Functions That I Wish I Knew Earlier

Поділитися
Вставка
  • Опубліковано 22 жов 2024

КОМЕНТАРІ • 120

  • @CodingIsFun
    @CodingIsFun  3 роки тому +9

    *Let me know which function was new for you, or even better, share your favourite pandas trick in the comments.*

    • @smbatharutyunyan5042
      @smbatharutyunyan5042 2 роки тому

      pd.cut is new for me, and is very useful. Thanks !!!

    • @BlueSkyGoldSun
      @BlueSkyGoldSun 2 роки тому

      Query
      Can we plot the conditional query ?

    • @CodingIsFun
      @CodingIsFun  2 роки тому

      @@BlueSkyGoldSun Can you perhaps elaborate on what it is you're actually trying to achieve? Please provide some additional info. Thanks!

  • @YYZ722
    @YYZ722 Рік тому +13

    The query function is new to me. It is similar to applying filters on the database, but definitely faster for generating results. Thank you for sharing!

    • @CodingIsFun
      @CodingIsFun  Рік тому

      Happy to hear that you learned something new. Thanks for watching and leaving a comment

  • @cryptomugen1315
    @cryptomugen1315 3 роки тому +9

    short and straight to the point. need more of these 4 min tips! thank you

    • @CodingIsFun
      @CodingIsFun  3 роки тому +1

      Thank you! Glad you liked the video. Today I will upload a 4min tips video on how to use Python's Pathlib module (to work with file paths & directories in Python) 😃

  • @boris1375
    @boris1375 Місяць тому

    Thanks! This is great. I was often frustrated heavy boolean filtering. Now I ll use the query method!

    • @CodingIsFun
      @CodingIsFun  Місяць тому

      Query is indeed very handy. I'm using it quite often. Thanks for watching! -Sven ✌️

  • @whatisagoodusernamehere
    @whatisagoodusernamehere 11 місяців тому +1

    Wow! What a revelation! Great video! I think this format deserves a whole playlist!

    • @CodingIsFun
      @CodingIsFun  11 місяців тому +1

      Appreciate your comment! Glad you found the video enjoyable. 👍

  • @sawyer82nd
    @sawyer82nd 2 роки тому +1

    Fantastisch! Kurz und sehr informativ!
    I've been using Pandas for a few months now and everything in this except groupby() was new to me. I can't believe I've watched two Pandas tutorials and this is the first time I've learned about query().

    • @CodingIsFun
      @CodingIsFun  2 роки тому

      Super, das freut mich zu hören! :)
      Thanks for watching and taking the time to leave a comment!

  • @Asparuh.Emilov
    @Asparuh.Emilov 3 роки тому +6

    That was amazing!!!!! Thank you so much! Your videos are truly meaningful! ❤️❤️❤️

    • @CodingIsFun
      @CodingIsFun  3 роки тому +1

      You are so welcome! Glad you like them. Thanks for watching & taking the time to leave a comment! ❤

  • @sandrakyoutube
    @sandrakyoutube 8 місяців тому

    Another great video. 👍 Flatten the multiindex and the cut func are new to me. Will serve me well! Thank you!

    • @CodingIsFun
      @CodingIsFun  8 місяців тому

      Happy to hear that you enjoyed this one too! Thanks for the comments and support, as always! ✌️

  • @andybecker5001
    @andybecker5001 Рік тому +1

    Never used cut before. Definitely a time saver if you need sub categories

    • @CodingIsFun
      @CodingIsFun  Рік тому

      Glad it was helpful and that you learned something new. Thanks for watching and taking the time to leave a comment!

  • @MrChristian902
    @MrChristian902 11 місяців тому

    Great tips, thanks! I was making many of these things the "Hard way "

    • @CodingIsFun
      @CodingIsFun  10 місяців тому

      Thanks for the positive feedback! Appreciate you taking the time to leave a comment.

  • @StalkedHuman
    @StalkedHuman 4 місяці тому

    These are the same functions i was feeling i needed to learn to get the function i needed

    • @CodingIsFun
      @CodingIsFun  4 місяці тому

      Glad it was helpful! Cheers, Sven ✌️

  • @marsshakirov4507
    @marsshakirov4507 2 роки тому +1

    Thank you very much! If you are looking for ideas, please do video about advanced combinations of groupby function and other methods.
    Anyway, thank you for short description in this video too :)

    • @CodingIsFun
      @CodingIsFun  2 роки тому

      Thanks for watching the video and your suggestion. I appreciate it! :)

  • @torque6389
    @torque6389 2 роки тому

    Great video. Query was new to me and I’ll definitely put it to work.

    • @CodingIsFun
      @CodingIsFun  2 роки тому

      Thank you and happy coding! :)

  • @zak_9351
    @zak_9351 Рік тому

    Thank you for some very useful tips. I didn't know of the nlargest & nsmallest functions so thanks for sharing those

    • @CodingIsFun
      @CodingIsFun  Рік тому

      An absolute pleasure, very happy to hear that you learned something new! Happy Coding! :)

  • @SantoRedentor
    @SantoRedentor 2 роки тому

    Thank you so much!
    Gotta go use the nlargest right now! It solves a problem that I have at the moment.

    • @CodingIsFun
      @CodingIsFun  2 роки тому

      Glad I could help! Thanks for watching and taking the time to leave a comment! :)

  • @Wilhuf1
    @Wilhuf1 Рік тому

    Didn’t know nsmallest and nlargest, along with cut. Great vid, thanks!

    • @CodingIsFun
      @CodingIsFun  Рік тому

      Happy to hear that it was useful; thank you for taking the time to leave a comment and for watching the video!

  • @gitgosc7075
    @gitgosc7075 2 роки тому

    wow, query() is completly new for me, awesome, thanks

    • @CodingIsFun
      @CodingIsFun  2 роки тому

      Thanks for watching the video & your comment! :)

  • @upalkundu2872
    @upalkundu2872 3 роки тому +1

    Really helpful. Gonna save my hours of hard work :")

    • @CodingIsFun
      @CodingIsFun  3 роки тому

      Glad to hear & thanks for watching the video! 😃

  • @sohambhattacharjee951
    @sohambhattacharjee951 Рік тому

    This was truly helpful.

    • @CodingIsFun
      @CodingIsFun  Рік тому

      Happy to hear that it was useful; thank you for taking the time to leave a comment and for watching the video!

  • @userhandle-u7b
    @userhandle-u7b Рік тому

    thanks a lot. very useful. You also showed the old way.

    • @CodingIsFun
      @CodingIsFun  Рік тому

      An absolute pleasure, very happy to hear that you found it useful!

  • @noeldoller2958
    @noeldoller2958 3 роки тому

    Very good short cut code.

  • @l--1226
    @l--1226 Рік тому

    Wonderfully done, Thanks

    • @CodingIsFun
      @CodingIsFun  Рік тому

      Glad to hear you liked it! Thank you for commenting and watching.

  • @doubando
    @doubando 9 місяців тому

    Thanks this is great, i like the agg() and cut()

    • @CodingIsFun
      @CodingIsFun  9 місяців тому

      Cool that you learned something new. Thanks for tuning in!

  • @geekyprogrammer4831
    @geekyprogrammer4831 2 роки тому

    Your videos are on the next level buddy! Keep it up. But, can you start with Machine Learning and Deep Learning course only the coding part that can be understood by everyone?

    • @CodingIsFun
      @CodingIsFun  2 роки тому +1

      Thanks! I was thinking about doing some Machine Learning tutorials, but I think there are already many excellent tutorials here on UA-cam. For now, I will stick to office (Excel) automation, visualisations fun Python projects :)

  • @mazkaibil9108
    @mazkaibil9108 Рік тому

    Amazing work! Thank you! I love your videos! Your videos have made my life easier. Most functions were new to me.

    • @CodingIsFun
      @CodingIsFun  Рік тому

      Hi Maz Kaibil, thanks so much for your kind words! I'm really glad to hear that my videos have been helpful and that you've learned some new things from them. It's always great to hear when my content has made a positive impact on someone's life. 👍

  • @elu1
    @elu1 Місяць тому

    float("inf") is cool

    • @CodingIsFun
      @CodingIsFun  Місяць тому

      Glad it was helpful! - Sven ✌️

  • @jqts6490
    @jqts6490 3 роки тому

    This is awesome! Saved and liked this video. I am actually working on groupby now to better master it for visuals. Not the best at setting up filters(using number or most of the time counting strings and numbers) and then using it in my groupbys to graph them.
    That said here is something really cool I found out.
    Making a new column filter and inserting it in the position I want for better comparing
    df.insert(1, “new column’s name”, df[“column1”] / df[“column2”])
    What the above does is inserts at index 1 a new column named whatever, and based on a condition(in this case dividing) so simple but 🤯

    • @jqts6490
      @jqts6490 3 роки тому

      Also want to say LOVE the query aspect. Now every time I use pandas I will be able to practice my SQL aspect at the same time. You rock man

    • @CodingIsFun
      @CodingIsFun  3 роки тому +1

      Glad you liked the Pandas tips! Thank you very much for watching the video & sharing your Pandas trick! 🐼 Happy Coding! 💪

  • @datamonster3212
    @datamonster3212 Рік тому

    How did you make the jupyter sections collapsible? Looks neat!

    • @CodingIsFun
      @CodingIsFun  Рік тому +1

      Check out collapsible headings: towardsdatascience.com/10-essential-jupyter-notebook-extensions-for-data-scientists-86b68ec7a66e

  • @hnclienteshn4501
    @hnclienteshn4501 3 роки тому

    Thank you very much for your tips, they are really very useful, excellent for continuing to share !!

    • @CodingIsFun
      @CodingIsFun  3 роки тому

      A pleasure! Thanks for watching the video & taking the time to leave a comment! ❤

  • @m4meeran
    @m4meeran 3 роки тому +1

    Cut and float('inf') was new for me

    • @CodingIsFun
      @CodingIsFun  3 роки тому +1

      Thanks for watching the video! :)

    • @m4meeran
      @m4meeran 3 роки тому

      @@CodingIsFun looking forward for more interesting videos like this.

  • @LouisDuran
    @LouisDuran 6 місяців тому

    Coming from a T-SQL background a lot of these functions seem to "make sense" as in they are idiomatic to what I wish to do with datasets. But I am glad to see working examples of this.

    • @CodingIsFun
      @CodingIsFun  6 місяців тому

      Thanks for watching! 👍Cheers, Sven ✌️

  • @bashar9200
    @bashar9200 Рік тому

    Fantastic!! Thank you

    • @CodingIsFun
      @CodingIsFun  Рік тому

      Glad to hear you liked it! Thank you for commenting and watching.

  • @vivdroid
    @vivdroid 3 роки тому

    Your tips are awesome 👏

    • @CodingIsFun
      @CodingIsFun  3 роки тому

      Thank you very much! Glad it was helpful!

  • @valensrwema
    @valensrwema 3 роки тому

    Amazing tips 👌 I really appreciate it.

    • @CodingIsFun
      @CodingIsFun  3 роки тому

      Thank you very much! Glad you liked the tips. 😃

  • @KhalilYasser
    @KhalilYasser 3 роки тому

    Thank you very much for your amazing tutorials.

    • @CodingIsFun
      @CodingIsFun  3 роки тому

      Thank you as always Yasser Khalil, your support is much appreciated! 👍

  • @user-qp8ei8lc3d
    @user-qp8ei8lc3d 3 роки тому

    Very good! Could you make a tutorial on data handling inside def, for loop functions? I wanted to know the importance of putting lines of code inside def functions for optimization.

    • @CodingIsFun
      @CodingIsFun  3 роки тому

      Thank you for watching the video & great suggestion! I cannot make any promises, but l will see what I can do.

  • @ermalgashimramori
    @ermalgashimramori 3 роки тому

    Great content as always.

    • @CodingIsFun
      @CodingIsFun  3 роки тому

      Thank you very much! ❤ I genuinely appreciate your support! 💪

  • @pedromerl
    @pedromerl 9 місяців тому

    THANK YOU!

    • @CodingIsFun
      @CodingIsFun  9 місяців тому +1

      My pleasure! Appreciate you taking the time to watch and leave a comment.

  • @yeahjustlikethat
    @yeahjustlikethat 2 роки тому

    I learned query thru your (awesome) streamlit tutorials. Didn't know about cut, super useful. Do you know how to cut in multiple dimensions? Say in this case, gender and tip? To produce an occurrence chart?

    • @CodingIsFun
      @CodingIsFun  2 роки тому

      Thank you very much for watching the video and your comment. I receive many requests for creating individual solutions. As much as I want to help, I simply do not find the time in my daily schedule to develop & test all the different requests. I hope you can understand. Thank you

  • @bodyart1460
    @bodyart1460 Рік тому

    Thank you

    • @CodingIsFun
      @CodingIsFun  Рік тому

      My pleasure! Appreciate you taking the time to watch and leave a comment. 👍

  • @JUN1ORLYONN
    @JUN1ORLYONN 3 роки тому

    Great video!!

    • @CodingIsFun
      @CodingIsFun  3 роки тому

      Glad you enjoyed it! Thanks for watching :)

  • @akshitabatra2500
    @akshitabatra2500 7 місяців тому

    Great Video :)

    • @CodingIsFun
      @CodingIsFun  7 місяців тому

      Glad to hear you liked it! Thank you for commenting and watching. Cheers, Sven ✌️

  • @__________________________6910
    @__________________________6910 3 роки тому

    Thanks man

    • @CodingIsFun
      @CodingIsFun  3 роки тому +1

      My pleasure! Thanks for taking the time to leave a comment :)

  • @samaritan5197
    @samaritan5197 2 роки тому

    Hi Sven, once again saw ur informative video. How to write SQL query displaying strings (select * from friend LIKE %string %) using pandas. I tried with str.contains but literally failed..

    • @CodingIsFun
      @CodingIsFun  2 роки тому +1

      This is not what pandas.query is supposed to do. Have a look at the following Stack Overflow post:
      stackoverflow.com/a/45866311
      I hope this helps!

  • @suryaryali4434
    @suryaryali4434 11 місяців тому

    Can you make while video on lambda

    • @CodingIsFun
      @CodingIsFun  10 місяців тому

      Thanks for watching and your suggestion!

  • @newday8074
    @newday8074 Рік тому

    Wow thank you

    • @CodingIsFun
      @CodingIsFun  Рік тому

      My pleasure! Appreciate you taking the time to watch and leave a comment.

  • @aliarshad111
    @aliarshad111 8 місяців тому

    Informative

    • @CodingIsFun
      @CodingIsFun  8 місяців тому

      Glad you liked it. Thanks for watching. Cheers, Sven ✌️

  • @omkarhankare3264
    @omkarhankare3264 3 роки тому

    Thanks 🐱

    • @CodingIsFun
      @CodingIsFun  3 роки тому +1

      A pleasure! Thank you for watching the video! :)

  • @chandraprakash934
    @chandraprakash934 Рік тому

    Amazing !

    • @CodingIsFun
      @CodingIsFun  Рік тому +1

      Glad you liked it. Thanks for watching and taking the time to leave a comment!

  • @asankacool1
    @asankacool1 3 роки тому

    @CodingIsFun Using aggregate function, how to get an aggregate reject% (defects/production)?
    df columns are |date | production| defects|

    • @CodingIsFun
      @CodingIsFun  3 роки тому

      Thanks for watching. I guess, you want to first insert a new column with the reject_ratio. Example:
      df['reject_ratio'] = df['defects'] / df['production']
      I hope this helps!

    • @asankacool1
      @asankacool1 3 роки тому

      @@CodingIsFun If a column is added, it will give daily reject ratio. But, what i want is a cumulative % (sum['rejects']/sum['production'])

    • @CodingIsFun
      @CodingIsFun  3 роки тому +1

      @@asankacool1, I do not know your data(frame), but perhaps you are looking for the cumsum function of pandas:
      pandas.pydata.org/docs/reference/api/pandas.DataFrame.cumsum.html

  • @djangoworldwide7925
    @djangoworldwide7925 9 місяців тому

    As an R user I must say you guys miss so much of dpkyr, tidyr and other powerful tools (such as inequality joins)

    • @CodingIsFun
      @CodingIsFun  9 місяців тому

      Never used R, so I would need to look up what those tools can do :)

  • @Apoorvpandey
    @Apoorvpandey 2 роки тому

    I really wish I knew these earlier

    • @CodingIsFun
      @CodingIsFun  2 роки тому

      Thanks for watching the video and your comment! :)

  • @marcelocampos665
    @marcelocampos665 10 місяців тому

    Excelente!

  • @deepakmehra8627
    @deepakmehra8627 3 роки тому +1

    Cut is new for me..

    • @CodingIsFun
      @CodingIsFun  3 роки тому

      Thanks for watching the video :)

  • @pritomroy2465
    @pritomroy2465 Рік тому

    as.index = False for flatten the data set

    • @CodingIsFun
      @CodingIsFun  Рік тому

      Thanks for watching the video and sharing your pandas tip! 👍