How to Reshape Dataframes | Pivot, Stack, Melt and More

Sdílet
Vložit
  • čas přidán 21. 07. 2024
  • When working with datasets you will need to change the shape and the perspective of the data. This is done sometimes for analysis purposes and sometimes just to explore the data a bit better. In this video, we learn 8 ways to change the shape of the dataframe we are working with to gain a new perspective on it. The functions we learn are:
    1. pivot
    2. pivot_table
    3. Stack
    4. Unstack
    5. Melt
    6. Groupby
    7. Crosstab
    8. Explode
    Find the code here: github.com/misraturp/Pandas-d...
    RESOURCES:
    🏃‍♀️ Data Science Kick-starter mini-course: www.misraturp.com/courses/dat...
    🐼 Pandas cheat sheet: misraturp.gumroad.com/l/pandascs
    📥 Streamlit template: misraturp.gumroad.com/l/stemp
    📝 NNs hyperparameters cheat sheet: www.misraturp.com/nn-hyperpar...
    📙 Fundamentals of Deep Learning in 25 pages: misraturp.gumroad.com/l/fdl
    COURSES:
    👩‍💻 Hands-on Data Science: Complete your first portfolio project: www.misraturp.com/hods
    🌎 Website - misraturp.com/
    🐥 Twitter - / misraturp
    00:00 Introduction
    00:42 Pivot
    02:12 Pivot_table
    04:24 Stack
    05:45 Unstack
    06:22 Melt
    07:53 Groupby
    09:22 Crosstab
    10:36 Explode
    12:03 Download the Pandas Cheat Sheet!
  • Věda a technologie

Komentáře • 41

  • @misraturp
    @misraturp  Před rokem +1

    👉 All you need to know about Pandas in one place!
    Download my Pandas Cheat Sheet (free)
    misraturp.gumroad.com/l/pandascs

  • @simple-stack-by-ed
    @simple-stack-by-ed Před 2 měsíci

    Straightforward explanation of pivot. Like earned!. Thx

  • @jonortiz81
    @jonortiz81 Před rokem

    For quite some time twitter hadn't recommended anything really interesting and valuable to watch. Nice video, I'm totally hooked to your content. 💪

    • @misraturp
      @misraturp  Před rokem

      That's amazing to hear, thank you John!

  • @uptoolate1896
    @uptoolate1896 Před rokem +2

    Your pandas cheat sheet is WAY more understandable (to me, at least) than the official one in the pandas documentation. Thanks for making it!

  • @jerrymarq3897
    @jerrymarq3897 Před rokem

    Good stuff I was trying to figure how to do counts by group. And that is the cross tab.

  • @josep_pacheco
    @josep_pacheco Před 2 lety

    Excelente contenido Misra, gracias : )

  • @tanishq6352
    @tanishq6352 Před rokem +1

    great video thanks for making my doubts clear of explode function and crosstab

  • @Hamza12123
    @Hamza12123 Před 7 měsíci

    very useful , thank you ma'am

  • @kevon217
    @kevon217 Před rokem +1

    Great overview!

  • @jugurthasemai727
    @jugurthasemai727 Před rokem +2

    Great job, thanks for this sharing, you're giving energy too ;-)

  • @akhilp6263
    @akhilp6263 Před rokem +1

    very useful.Thank you

  • @automatewithamit
    @automatewithamit Před 4 měsíci

    Thanks for your Video !
    Can you please let me know if we can put those collapse and expand functionality in actually generated pivot table in excel using python ??

  • @PeterPankowski
    @PeterPankowski Před 7 měsíci

    Very nice

  • @mjacfardk
    @mjacfardk Před 2 lety +1

    Thank you very much, for your valuable efforts, I don't know how to thank you, anyway thank you always. Please make us groupby tutorial and how to compare it with pivot tables 🙏

    • @misraturp
      @misraturp  Před 2 lety +1

      You are very welcome! The groupby video is on the way!

  • @arpeshmistry6550
    @arpeshmistry6550 Před 11 měsíci

    Nice tutorial on pivot. I have one query, is there any way we can create the data-link in pivot like we do in excel. Pls help

  • @JayLim-bn9fh
    @JayLim-bn9fh Před 26 dny

    Thanks I just subbed

  • @ericliu3366
    @ericliu3366 Před 8 měsíci

    Hi I like your videos. BTW, how you get the Juypter to have output horizontal scrollable. My Anaconda Juypter cannot.😊

  • @GregThatcher
    @GregThatcher Před 2 měsíci

    Thanks!

    • @misraturp
      @misraturp  Před 2 měsíci

      Thank you Greg! Really appreciate your support!

  • @viniciusoviedo
    @viniciusoviedo Před rokem

    Awesome content...Thanks for sharing it!
    Which screen recorder do you use? I really like it. Best!

    • @misraturp
      @misraturp  Před rokem +3

      Thank you Vinícius! I use ScreenFlow.

  • @am0x01
    @am0x01 Před rokem

    I’m in love

  • @jianlinchen7978
    @jianlinchen7978 Před 5 měsíci

    pandas looks a little bit complex than power query. ... So what is pandas's strength?

  • @aakashniture
    @aakashniture Před 5 měsíci

    Hi Misra, amazing video.
    I have a doubt. I performed pivot_table() and after getting new columns.. I am not able to select those new columns or save one new column in new df.
    E.g. in above video after pivoting you got A, B, C as new columns.. i can not select df['A']? It gives error. When i do df.shape() it shows A, B, C as columns.
    Please help.

  • @pomme_paille
    @pomme_paille Před rokem +2

    I'm confused at the difference between stack and melt 😅

  • @sanooosai
    @sanooosai Před rokem +1

    great tutorial, Eva mendes look like you

  • @hedeyhod
    @hedeyhod Před rokem

    I think it's hard to understand for beginners. especially melt function. maybe you should slow down when you explain examples. thank you so much for tutorial.

  • @johnspivack6520
    @johnspivack6520 Před rokem

    Thanks for the video. Brilliant person, but why talk so fast? I had to stop it about a twenty times and puzzle out what was being said. After I did, it made sense, but why not slow down to a more comfortable pace? By the way, 'SVCS' means 'Services', isn't it obvious from the context?