4 Pandas Functions That I Wish I Knew Earlier

แชร์
ฝัง
  • เผยแพร่เมื่อ 22 ก.ค. 2024
  • 👉 Explore All My Excel Solutions: pythonandvba.com/solutions
    𝗗𝗘𝗦𝗖𝗥𝗜𝗣𝗧𝗜𝗢𝗡
    ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
    In this video, I'm going to share with you 4 Pandas functions that I wish I knew earlier. These functions will make data analysis much easier and faster for you!
    Download the Jupyter Notebook here:
    ► github.com/Sven-Bo/four-panda...
    𝗧𝗢𝗢𝗟𝗦 𝗔𝗡𝗗 𝗥𝗘𝗦𝗢𝗨𝗥𝗖𝗘𝗦
    ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
    🆓【𝗙𝗥𝗘𝗘】Excel Add-in (𝗠𝘆𝗧𝗼𝗼𝗹𝗕𝗲𝗹𝘁): pythonandvba.com/mytoolbelt
    📊 Dashboard Excel Add-In (𝗚𝗿𝗮𝗳𝗹𝘆): pythonandvba.com/grafly
    🎨 Cartoon Charts Excel Add-In (𝗖𝘂𝘁𝗲𝗣𝗹𝗼𝘁𝘀): pythonandvba.com/cuteplots
    🤪 Fun Emoji Excel Add-In (𝗘𝗺𝗼𝗷𝗶𝗳𝘆): pythonandvba.com/emojify
    📑 Excel Templates: pythonandvba.com/go/excel-tem...
    🎓 My Courses: pythonandvba.com/go/courses
    📚 Books, Tools, and More: pythonandvba.com/resources
    𝗖𝗢𝗡𝗡𝗘𝗖𝗧 𝗪𝗜𝗧𝗛 𝗠𝗘
    ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
    🔗 LinkedIn: / sven-bosau
    📸 Instagram: / codingisfun_official
    💻 GitHub: github.com/Sven-Bo
    💬 Discord: pythonandvba.com/discord
    📬 Contact: pythonandvba.com/contact
    ☕ 𝗕𝘂𝘆 𝗺𝗲 𝗮 𝗰𝗼𝗳𝗳𝗲𝗲?
    If you want to support this channel, you can buy me a coffee here: pythonandvba.com/coffee-donation

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

  • @CodingIsFun
    @CodingIsFun  2 ปีที่แล้ว +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 10 หลายเดือนก่อน +12

    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  10 หลายเดือนก่อน

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

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

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

    • @CodingIsFun
      @CodingIsFun  2 ปีที่แล้ว +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) 😃

  • @whatisagoodusernamehere
    @whatisagoodusernamehere 8 หลายเดือนก่อน +1

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

    • @CodingIsFun
      @CodingIsFun  8 หลายเดือนก่อน +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 2 ปีที่แล้ว +6

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

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

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

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

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

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

      Glad it was helpful! Cheers, Sven ✌️

  • @sandrakyoutube
    @sandrakyoutube 5 หลายเดือนก่อน

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

    • @CodingIsFun
      @CodingIsFun  5 หลายเดือนก่อน

      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 8 หลายเดือนก่อน

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

    • @CodingIsFun
      @CodingIsFun  7 หลายเดือนก่อน

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

  • @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! :)

  • @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. 👍

  • @tuxib
    @tuxib 10 หลายเดือนก่อน

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

    • @CodingIsFun
      @CodingIsFun  10 หลายเดือนก่อน

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

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

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

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

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

  • @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! :)

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

    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 2 ปีที่แล้ว

      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  2 ปีที่แล้ว +1

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

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

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

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

      Thanks for watching the video & your comment! :)

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

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

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

      Glad to hear & thanks for watching the video! 😃

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

    Thank you very much for your amazing tutorials.

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

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

  • @l--1226
    @l--1226 ปีที่แล้ว

    Wonderfully done, Thanks

    • @CodingIsFun
      @CodingIsFun  ปีที่แล้ว

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

  • @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!

  • @user-jh4wo6ok4s
    @user-jh4wo6ok4s ปีที่แล้ว

    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!

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

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

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

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

  • @user-qp8ei8lc3d
    @user-qp8ei8lc3d 2 ปีที่แล้ว

    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  2 ปีที่แล้ว

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

  • @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 TH-cam. For now, I will stick to office (Excel) automation, visualisations fun Python projects :)

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

    Amazing tips 👌 I really appreciate it.

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

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

  • @Wilhuf1
    @Wilhuf1 11 หลายเดือนก่อน

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

    • @CodingIsFun
      @CodingIsFun  11 หลายเดือนก่อน

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

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

    Very good short cut code.

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

      Thank you very much! 😃

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

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

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

      Thanks for watching the video! :)

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

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

  • @bashar9200
    @bashar9200 ปีที่แล้ว

    Fantastic!! Thank you

    • @CodingIsFun
      @CodingIsFun  ปีที่แล้ว

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

  • @LouisDuran
    @LouisDuran 3 หลายเดือนก่อน

    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  3 หลายเดือนก่อน

      Thanks for watching! 👍Cheers, Sven ✌️

  • @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

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

    Your tips are awesome 👏

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

      Thank you very much! Glad it was helpful!

  • @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

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

    Great content as always.

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

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

  • @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!

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

    Great video!!

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

      Glad you enjoyed it! Thanks for watching :)

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

    THANK YOU!

    • @CodingIsFun
      @CodingIsFun  6 หลายเดือนก่อน +1

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

  • @akshitabatra2500
    @akshitabatra2500 4 หลายเดือนก่อน

    Great Video :)

    • @CodingIsFun
      @CodingIsFun  4 หลายเดือนก่อน

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

  • @chandraprakash934
    @chandraprakash934 ปีที่แล้ว

    Amazing !

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

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

  • @aliarshad111
    @aliarshad111 5 หลายเดือนก่อน

    Informative

    • @CodingIsFun
      @CodingIsFun  5 หลายเดือนก่อน

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

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

    Thanks man

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

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

  • @bodyart1460
    @bodyart1460 ปีที่แล้ว

    Thank you

    • @CodingIsFun
      @CodingIsFun  ปีที่แล้ว

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

  • @marcelocampos665
    @marcelocampos665 7 หลายเดือนก่อน

    Excelente!

    • @CodingIsFun
      @CodingIsFun  7 หลายเดือนก่อน

      Thanks! :)

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

    Thanks 🐱

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

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

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

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

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

      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 2 ปีที่แล้ว

      @@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  2 ปีที่แล้ว +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

  • @newday8074
    @newday8074 ปีที่แล้ว

    Wow thank you

    • @CodingIsFun
      @CodingIsFun  ปีที่แล้ว

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

  • @suryaryali4434
    @suryaryali4434 8 หลายเดือนก่อน

    Can you make while video on lambda

    • @CodingIsFun
      @CodingIsFun  7 หลายเดือนก่อน

      Thanks for watching and your suggestion!

  • @Apoorvpandey
    @Apoorvpandey ปีที่แล้ว

    I really wish I knew these earlier

    • @CodingIsFun
      @CodingIsFun  ปีที่แล้ว

      Thanks for watching the video and your comment! :)

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

    Cut is new for me..

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

      Thanks for watching the video :)

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

    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  6 หลายเดือนก่อน

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

  • @pritomroy2465
    @pritomroy2465 ปีที่แล้ว

    as.index = False for flatten the data set

    • @CodingIsFun
      @CodingIsFun  ปีที่แล้ว

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