Python Pandas Tutorial (Part 3): Indexes - How to Set, Reset, and Use Indexes

แชร์
ฝัง
  • เผยแพร่เมื่อ 3 ธ.ค. 2024

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

  • @coreyms
    @coreyms  4 ปีที่แล้ว +117

    Hey everybody. I hope everyone's week is starting off well. I'm still working on the next video in the series, so I don't have a specific release date just yet. Just keep your eyes open. I'm hoping to have this entire series finished soon, but I'm not sure how long it will take me to record/edit the remaining video. I'll do my best to get them out ASAP (this week or next). Have a good one!

    • @prakharthapak4229
      @prakharthapak4229 4 ปีที่แล้ว +2

      Hi Corey, can you please do tutorials on pytorch ? That would be so useful.

    • @alanbarzilay6866
      @alanbarzilay6866 4 ปีที่แล้ว +2

      Hi, have you seen the release of pandas 1.0?pandas.pydata.org/pandas-docs/version/1.0.0/whatsnew/v1.0.0.html
      Is this going to affect this series in any way?
      Also thank your for all of your work! You do an incredible job!

    • @SHUBHITTALUSBIS
      @SHUBHITTALUSBIS 4 ปีที่แล้ว

      Sir how many videos are in this series?

    • @waynezor
      @waynezor 4 ปีที่แล้ว

      @@alanbarzilay6866 It's still a release candidate, so probably not. However, everything here could at some point become obsolete for sure.
      The documentation on pandas is mostly pretty nice, so I would just look up how to do some specific thing should the "old way" stop working.

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

      @@waynezor Release candidate means that features are probably set, it just needs more testing before they release the stable version. Agree with the rest, but why not include the new things if they are worth noting from now on?

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

    Even after 4 years, this is the best Pandas video on TH-cam. Thank you Corey , for this.

  • @sheilaokolie93
    @sheilaokolie93 2 ปีที่แล้ว +5

    Talk about beginner friendly?? This is one!!! Hands down the best!!!!!!!

  • @p3000g1
    @p3000g1 2 ปีที่แล้ว +63

    Hands down best python tutorials on youtube. Nobody does so much for free. Thanks Corey

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

      it isn't free

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

      @@im4485 I def subscribed to brilliant.

  • @bartoszturkowyd3608
    @bartoszturkowyd3608 4 ปีที่แล้ว +78

    I'm using pandas for a quite long time and sometimes I found it annoying (yet still very useful and mandatory in data science). Your videos make this library crystal clear. Thank you for this!

  • @736939
    @736939 4 ปีที่แล้ว +122

    Thank you Corey. After this Pandas tutorials, please start the scikit-Learn and then TensorFlow2 tutorials

    • @ryanlee619
      @ryanlee619 4 ปีที่แล้ว +4

      most likely never going to happen :(, but this would be soo good

    • @historywithreese
      @historywithreese 3 ปีที่แล้ว

      Wish that could be possible. ':(

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

    How Kind Can Someone Be?
    He explains each and every detail and also explain things repeatedly so that anyone coming any of the video in the middle of the series will find it easy to follow the video.

  • @alexandertsiolkovski5848
    @alexandertsiolkovski5848 4 ปีที่แล้ว +35

    Corey, I just want to appreciate your work here. I am learning a lot from your videos. Thank you for making them freely available.

  • @philinnc
    @philinnc 4 ปีที่แล้ว +13

    Pandas is an enormously helpful tool with good documentation, but for those of us who learn best by example there can be a steep learning curve. These tutorials are the best I've seen for clearly and methodically working through the basics.

  • @roberta.42
    @roberta.42 2 ปีที่แล้ว +15

    Chapters:
    00:00 Intro
    00:30 Recap of Dataset
    01:00 Recap of What's an Index
    02:06 How to Set DataFrame (Row) Indexes ('df.set_index('col_to_use')')
    02:35 'inplace' Argument
    03:40 '.index' Attribute
    05:13 How to Reset (Row) Indeces ('df.reset_index()')
    06:16 Set (Row) Index on DataFrame Creation () and Practice on Real-World Dataset ('pd.read_csv('file.csv', index_col='col_to_use')'
    12:58 Sort Indexes (`df.sort_index(ascending=False)`)
    15:02 Outro
    Copied from @Adam Hendry for future reference

  • @kasyapdharanikota8570
    @kasyapdharanikota8570 3 ปีที่แล้ว +4

    your tutorials are far better than the paid ones on other platforms

  • @egyptsphinx9393
    @egyptsphinx9393 4 ปีที่แล้ว +2

    I can`t ensure if you will believe me or not when i tell you that i downloaded 130 tutorial video of your content about python, but the most important thing that i am sure about is, you are awesome, keep going believer

  • @sarangkharpate5780
    @sarangkharpate5780 4 ปีที่แล้ว +11

    I learned Pandas on my own, by hit and trial, but after watching these videos, finally I am able to connect the dots and make some sense why things are like this. Thanks Corey, this will save my time to google every command :)

  • @EdwardRLyons
    @EdwardRLyons 4 ปีที่แล้ว +11

    Thank you for this particular video. It's explained indexing in 15 minutes with much greater clarity than anything else I've used so far.

  • @hameem6845
    @hameem6845 4 ปีที่แล้ว +11

    I am using a string index in my current project and this is all very useful. Thanks! This pandas series is gonna be awesome.

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

    You know what Corey, you are the only person I would like to thank once I become a data scientist...

  • @Rafian1924
    @Rafian1924 ปีที่แล้ว +3

    Thanks a lot Corey.. you are the best instructor out there.. I can't even imagine learning from anybody else. Can you please consider creating a series on pyspark and machine learning??

  • @sebastianhernandez3059
    @sebastianhernandez3059 4 ปีที่แล้ว +8

    Can't believe how awesome you are! Really enjoying this series so far your instructions are so thorough and simple, you've really helped me grow so much in my aspirations. Thank you so much Corey, hope all is well in this tough time.

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

    Wow, these videos are seriously so helpful! I've just been getting started with pandas, feeling frustrated because I just don't understand the syntax super well yet and thus having to google literally everything. This is making it so much easier to understand! I can't thank you enough and I'm looking forward to getting through all the videos! :)

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

    Awesome, this is best Pandas series so far I have watched on internet...

  • @meta_ai
    @meta_ai 4 ปีที่แล้ว +9

    BEST #PYTHON #channel ever

  • @REKHAKUMARI-lv8mz
    @REKHAKUMARI-lv8mz 4 ปีที่แล้ว +3

    Thanks a lot, Corey! It's evident that you put in a lot of effort into making your videos flawless. Where else could I get such clear and thorough explanations !?!

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

    I am an amateur coder, I also have never posted a TH-cam comment, but thank you.... these videos are incredible

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

    Thanks Corey for this awesome series... You are making complex things looks simple.. What I like the most about your series is that your Tutorial flow by explaining simple to complex in an understandable manner.. Keep this good work, you are bringing in differences in many Techies lives.

  • @nathandai7510
    @nathandai7510 4 ปีที่แล้ว +23

    7:20
    respondent 0: "I am a sttudent learning to code"
    stack overflow: "are you a student"
    respondent 0: "no"
    stack overflow: "what is your education level"
    respondent 0: "elementary school"
    stack overflow: *mike wazowski bruh face

    • @hRECKit
      @hRECKit 3 ปีที่แล้ว

      i dont need sleep i need answers

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

    Thanks for this series, @Corey! Very helpful and very well done. I went to Brilliant to check them out to thank them for sponsoring your videos! Thanks Brilliant!

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

    I enjoyed this video so much, thank you so much, I'm recommending your channel to all my friends. Watching your videos is a must!
    Thank you so much!!

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

    1.To reset index after loading csv ; df.reset_index
    2 to set index after reading CSV; df.set_index(" ")
    3.To reset index in place and permanently change dataframe ; df.reset_index(inplace= True)
    4. To set index while reading the data(csv) ; df = pd.read_csv('data/survey_results_public.csv', index_col =" ")
    5. To sort your index alphabetically; df.index_sort
    5. To sort your index alphabetically in a descending order; df.index_sort(ascending = False)

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

    I don't know how to thank you enough for this free gift. I wish I could subscribe more than once to this channel. you turn my life around. thank you

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

    Watching one video everyday after work! Thanks for the amazing videos. They're easy to follow. I am looking forward to check the other courses as well.

  • @vijaybabu3923
    @vijaybabu3923 4 ปีที่แล้ว +2

    Very nice video.. will recommend anyone who is in the world of data engineering. will look forward for the next video! Thank you Corey 👍

  • @sandeepsingh-sp7yn
    @sandeepsingh-sp7yn 4 ปีที่แล้ว +4

    Hey Corey, Your way of teaching is really awesome, Anyone who is beginner can also grab it and take it forward easily. Waiting for your upcoming videos on pandas :-) and looking forward to new series in python like numpy etc. which can help us in data analysis. You are doing a great job.

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

    This series is an instructional masterpiece!

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

    Hey Corey, you did justice to this lecture! All for free! Be blessed!

  • @SolvingOptimizationProblems
    @SolvingOptimizationProblems 4 ปีที่แล้ว +2

    The index tips are so useful to work with dataframe. Thank you for such a great work.

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

    watched 1 and 2 . the best tutorial. And am watching the third. thanks a lot. you are the best.

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

    I am finally getting into Pandas and these videos have been great!!!

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

    I keep refering back to these pandas tutorial videos whenever I needed. Great job @coreyms.

  • @dianavillescas
    @dianavillescas 3 ปีที่แล้ว

    I a so glad I found you video. Finally I found the answer I was looking for for 2 hours!. Thank you.

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

    Really great videos Part 1, 2 and now 3. It was so hard to find a good Pandas tutorial but yours is Ivy School level explanation. 🎉

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

    Talk about timing, I just started this series this morning

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

    You are extremely a nice teacher. Good and detailed explanations in all your videos i have watched. Keep it up rolling for us beginners

  • @saitaro
    @saitaro 4 ปีที่แล้ว +3

    This is top quality stuff again. As always from Corey.

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

    Thanks Mr Corey, you are such a great teacher.

  • @IvanToman
    @IvanToman 4 ปีที่แล้ว +68

    Manager Idiot is the best

    • @akioo9495
      @akioo9495 4 ปีที่แล้ว +5

      they removed that question in 2020 survey xD

  • @dark4krad
    @dark4krad 4 ปีที่แล้ว +4

    About time. Great timing! Thank you sir! Respect to you!

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

    i can't believe I'm getting this for free
    thank you sir

  • @DanteHellDrive
    @DanteHellDrive 4 ปีที่แล้ว +2

    wow excellent tutorial, really well explained with awesome clarity. Keep up the good work!

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

    Great video, thank you! 14:000 I know you covered - pd.set_options('display.max_columns',##) but I can't seem to get the schema dataframe to show that even if I do run that... - nevermind, I figured it out. It was just pd.set_options('display.max_rows',##) and I think you did cover that! Anyway, thanks again Corey!

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

    Thanks, Corey! This playlist is really insightful

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

    Best possible explanations ever...

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

    Thank you for the video. I am grateful for your time and contribution. Kind regards, Akira.

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

    So nice! I will like and coment in every video of this set! You deserve the best! thanks!

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

    Yet another lovely lesson. Nice flow with a good combination of motivation and technical instruction. Thanks.
    Just wondering how common the inplace=True argument is across Python generally, or is it specific to Pandas- first time I've seen it.

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

    Great tutorial video as always. Thanks!

  • @VikasGuptacherie
    @VikasGuptacherie 4 ปีที่แล้ว +2

    Thank you!! Very important and nice video series

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

    Great course with clear explanation, great help to me. Thanks a lot.

  •  4 ปีที่แล้ว +2

    Hey Corey. Your tutorials are awesome. It would be great if you produce how to use importlib library and dynamic module importing tutorials in future videos. Thank you very much.

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

    Thank you so much for this wonderful pandas series🙏

  • @TopicalAuthority
    @TopicalAuthority 4 ปีที่แล้ว +2

    Great lesson thank you!

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

    Thank you very much for this clear and informative video! 😄

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

    Hey Corey
    A very good series. Learning from these and applying to Python visuals in Power BI. A bit limited in options there.
    Would it interest you to make a few videos on handling Python in Power BI?
    Thanks

  • @mohameda.abokhoshiem2624
    @mohameda.abokhoshiem2624 4 ปีที่แล้ว

    Corey Schafer, you 're amazing. Thank you.

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

    Thanks a lot Corey, your videos are very helpful :)

  • @ishanpand3y
    @ishanpand3y 4 ปีที่แล้ว +2

    Thank you, Sir! 🧡🤍💚

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

    As usual great video, thanks again!

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

    Great lesson! Thank you!

  • @omeryazici5318
    @omeryazici5318 3 ปีที่แล้ว

    print("BEST PYTHON LESSON ON UNIVERSE")

  • @usmonov_dev
    @usmonov_dev 4 ปีที่แล้ว

    Thank you bro ;) Couldn't wait to make data visualization.

  • @BrijeshYadav-vl7bj
    @BrijeshYadav-vl7bj 3 หลายเดือนก่อน

    Very helpful videos indeed.

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

    Very nice tutorial. Thank you.

  • @youssefelbieh2939
    @youssefelbieh2939 4 ปีที่แล้ว +3

    Please Corey.. We need docker and microservices

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

    Thanks man this very useful !!

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

    Thank you for the great videos .

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

    Hi teacher, I love the videos, Thanks for taking us through,
    My data set after loading it in pandas its showing the "NaN" columns that are not there when i open the file direct using excel, what could be the issue?

  • @rodkrebs9140
    @rodkrebs9140 3 ปีที่แล้ว

    Thanks!! very insightful, good video

  • @sharbi9943
    @sharbi9943 4 ปีที่แล้ว

    Can't understand why would anyone dislike such a high quality work?!!! Thank you Corey...
    one simple question, when using methods (df.set_index()) I get an error on Spyder.
    'DataFrame' object has no attribute 'set_index'.... it works if pd.set_index is used instead?

  • @ajitesh764
    @ajitesh764 4 ปีที่แล้ว +2

    1st comment...didn't watch it...first i like corey's video then i watch it...PS: First i disable my adblock....i urge everyone to do the same. Just out of curiosity...how many videos this pandas series consist of?..thank you for amazing videos..you're the best teacher Corey.

    • @coreyms
      @coreyms  4 ปีที่แล้ว +9

      I still haven't finished recording the series yet, so I'm not exactly sure how I'll break up the last videos. But I _think_ it's going to end up being around 10 videos or so. Then I'm going to do another series of 5-10 videos specifically on plotting in Pandas.

    • @bhaukalifacts7139
      @bhaukalifacts7139 4 ปีที่แล้ว +2

      Sir Can you please make Videos on ML also. You teach like a teacher is teaching to a 1st class student. I am very curious to study ML lectures by you Sir. Thankyou very much sir .😊😊

  • @warrenvanwyck2765
    @warrenvanwyck2765 4 ปีที่แล้ว

    Overall good stuff. More thought needs to be given when choosing example data. For rows and columns it's natural to speak of the first or last row -- and even the first or last column.. Using 'first' and 'last' for column names is needlessly ambiguous.

  • @ganeshbala
    @ganeshbala 4 ปีที่แล้ว

    Thank you, Corey!

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

    Good job!

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

    You deserve ⭐️⭐️⭐️⭐️⭐️

  • @joro8604
    @joro8604 4 ปีที่แล้ว

    So well explained....

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

    @coreyschafer. (or anyone who can help me) @11:40. I'm running this code on Pycharm while following your video and I'm getting a 'KeyError: 'MgrIdiot' message. The code has worked exactly as it should for any other row I've tried to look up ('Hobbyist', 'Age', etc).
    Any idea why pycharm would specifically show a KeyError just for the 'MgrIdiot' row? I tried running schema_df = schema_df.astype('str) to change all values to strings, but that didn't help.
    Thanks!

  • @GREATEXTREME7
    @GREATEXTREME7 4 ปีที่แล้ว

    Love your videos

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

    3 down, 8 to go.. Dated 5/25/2023

  • @akhilmehta8248
    @akhilmehta8248 4 ปีที่แล้ว +3

    Thank you Corey for the video.
    I have a small doubt:
    pd.set_option('display.max_columns',85)
    pd.set_option('display.max_rows',85)
    After this command if we print df, shouldn't we see 85 rows of df?
    Or am I getting this wrong?

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

      Corey, I have same question as this

  • @SNK19151
    @SNK19151 3 ปีที่แล้ว

    Thanks bro you're so amazing

  • @داوداحمدی-ش9ع
    @داوداحمدی-ش9ع 2 ปีที่แล้ว

    Am from Iran
    I love u😍

  • @joysharma8599
    @joysharma8599 4 ปีที่แล้ว

    hey corey, please create some videos on numpy!

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

    Hi Corey, thank you so much for this tutorial but I keep getting something missed up, Iin what context do we use the normal parenthesis (), this {} and the squared bracket [] ????

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

    Thankyou Sir

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

    I followed your example for indexes. df.loc(). It works perfectly. However if I use df.loc[1:10,:], it throws an error. If I use another new dataframe object without having to create any indexes then df.loc[1:10,:], then it works perfectly. Please help me understand what's this confusion.

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

      I think it's cause u can't run loc after u do inplace=true

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

    Thanks a lot. My question is how let index start from 1 instead of 0? Also, how to show ordinal number instead of ordinary numbers?

  • @cllim80
    @cllim80 4 ปีที่แล้ว

    Hi Corey, at video time 6:33, after df.rest_index(inplace=True) it resets the index but now email column becoming the first column. How we can move the email column to the last column ? Thank you.

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

    thankyou 🙂

  • @debojitmandal8670
    @debojitmandal8670 3 ปีที่แล้ว

    Can you please also make machine learning tutorials .
    And please provide time stamp for this video.

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

    @Corey Schafer Thanks for the tutorial it's really very good but how you can access the questions from another excel?

  • @CSSuccessGamer
    @CSSuccessGamer 4 ปีที่แล้ว

    Do you have any real world projects with problems and solutions using pandas? Thanks for tutorials but i want to see more real life problems/solutions.

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

    Remercie for your work!