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

Поделиться
HTML-код
  • Опубликовано: 2 июл 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!
  • НаукаНаука

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

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

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

  • @uptoolate1896
    @uptoolate1896 Год назад +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!

  • @simple-stack-by-ed
    @simple-stack-by-ed 2 месяца назад

    Straightforward explanation of pivot. Like earned!. Thx

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

    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  Год назад

      That's amazing to hear, thank you John!

  • @jerrymarq3897
    @jerrymarq3897 11 месяцев назад

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

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

    Excelente contenido Misra, gracias : )

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

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

  • @Hamza12123
    @Hamza12123 6 месяцев назад

    very useful , thank you ma'am

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

    Great overview!

  • @jugurthasemai727
    @jugurthasemai727 Год назад +2

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

  • @JayLim-bn9fh
    @JayLim-bn9fh 6 дней назад

    Thanks I just subbed

  • @PeterPankowski
    @PeterPankowski 6 месяцев назад

    Very nice

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

    very useful.Thank you

  • @am0x01
    @am0x01 11 месяцев назад

    I’m in love

  • @mjacfardk
    @mjacfardk Год назад +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  Год назад +1

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

  • @automatewithamit
    @automatewithamit 3 месяца назад

    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 ??

  • @GregThatcher
    @GregThatcher 2 месяца назад

    Thanks!

    • @misraturp
      @misraturp  2 месяца назад

      Thank you Greg! Really appreciate your support!

  • @arpeshmistry6550
    @arpeshmistry6550 10 месяцев назад

    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

  • @ericliu3366
    @ericliu3366 7 месяцев назад

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

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

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

    • @misraturp
      @misraturp  Год назад +3

      Thank you Vinícius! I use ScreenFlow.

  • @aakashniture
    @aakashniture 5 месяцев назад

    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.

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

    great tutorial, Eva mendes look like you

  • @jianlinchen7978
    @jianlinchen7978 4 месяца назад

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

  • @pomme_paille
    @pomme_paille Год назад +2

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

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

    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 Год назад

    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?