Python Pandas Tutorial (Part 7): Sorting Data

  Рет қаралды 193,818

Corey Schafer

Corey Schafer

Күн бұрын

In this video, we will be learning how to sort DataFrames in Pandas.
This video is sponsored by Brilliant. Go to brilliant.org/cms to sign up for free. Be one of the first 200 people to sign up with this link and get 20% off your premium subscription.
In this Python Programming video, we will be learning how to sort our data. We will learn how to sort single columns, sort multiple columns, and view the largest and smallest values in a DataFrame. Let's get started...
The code for this video can be found at:
bit.ly/Pandas-07
StackOverflow Survey Download Page - bit.ly/SO-Surve...
✅ Support My Channel Through Patreon:
/ coreyms
✅ Become a Channel Member:
/ @coreyms
✅ One-Time Contribution Through PayPal:
goo.gl/649HFY
✅ Cryptocurrency Donations:
Bitcoin Wallet - 3MPH8oY2EAgbLVy7RBMinwcBntggi7qeG3
Ethereum Wallet - 0x151649418616068fB46C3598083817101d3bCD33
Litecoin Wallet - MPvEBY5fxGkmPQgocfJbxP6EmTo5UUXMot
✅ Corey's Public Amazon Wishlist
a.co/inIyro1
✅ Equipment I Use and Books I Recommend:
www.amazon.com...
▶️ You Can Find Me On:
My Website - coreyms.com/
My Second Channel - / coreymschafer
Facebook - / coreymschafer
Twitter - / coreymschafer
Instagram - / coreymschafer
#Python #Pandas

Пікірлер: 184
@coreyms
@coreyms 4 жыл бұрын
Hey everyone. Hope you're having a great week! I've tried taking your suggestions to heart and tried making the videos shorter without sacrificing any of the details I believe are important. Let me know if there is anything specific you want me to cover in Pandas as I continue this series. In the next video, we'll be learning how to group and aggregate data, which will open a lot of possibilities for exploring our data.
@k1mfor
@k1mfor 4 жыл бұрын
Thanks Corey! Here's a few ideas for interesting pandas topics: 1) comparing a row's values to the row(s) above (or below) (shift), and populating a series based on that, 2) MultiIndex (this one always seems annoying), 3) Categorical, 4) pivot and pivot_table, and 5) joining/merging dataframes.
@ajitesh764
@ajitesh764 4 жыл бұрын
Doesn't matter if the videos are short or long as long as it doesn't sacrifice the details. I didn't find any problem with one of your videos that was about 40 min long. People who want shorter videos are the impatient ones, they want to learn such valuable concepts in a short period of time and want some kind of magic to happen that will make them a pro overnight after they finish the series.
@bakihussain4231
@bakihussain4231 4 жыл бұрын
Can you also add matplotlib in this series to visualize data and how it changes?
@thiagohenrique1141
@thiagohenrique1141 4 жыл бұрын
@@bakihussain4231 This would be good.
@mcleanb981
@mcleanb981 4 жыл бұрын
Hey Corey, think you could do a series on tensorflow or pytorch?
@titandegroot
@titandegroot 4 жыл бұрын
Corey, I would not worry about the length of the videos,. I love the way you discuss the entire concept from beginning to end. Don't change anything.
@MrRahul15937
@MrRahul15937 Жыл бұрын
completely agree
@Davidkiania
@Davidkiania 4 жыл бұрын
Loving the series don’t change anything even the length. There’s a forward button for that.
@ihgnmah
@ihgnmah 4 жыл бұрын
True
@AugustoGeografo
@AugustoGeografo 4 жыл бұрын
Corey, you use the amount of time you find appropriate. You are a excellent and very didactic tutor. If you think a video must be long to convey a message, you go with your instinct.
@danielbristow4819
@danielbristow4819 4 жыл бұрын
Could not agree more. This is a free service that is an absolute game changer.
@programmingcheatsheet
@programmingcheatsheet 3 жыл бұрын
I usually try binging these anyway. Excellent job as always, Corey
@kameshinipillay4587
@kameshinipillay4587 2 жыл бұрын
@@programmingcheatsheet haha same!
@shivajishinde1496
@shivajishinde1496 4 жыл бұрын
I don't believe these valuable lectures are free. All lectures series will definitely be seen by everyone who really wants to go the basics of these contents. Each and every steps/topic is explained very well. Thank you very very much for spending time for us. You are taking too much effort to make these video, and I really appreciate your efforts. I really have no words for it. God bless you! And You are the best python teacher I have had, I must say!!!
@benjamindeporte3806
@benjamindeporte3806 4 жыл бұрын
I loved the comment on the 2M$ salary :-) Joke aside - great series, all 7 in a row so far, good content, length and details.
@jackfrost8969
@jackfrost8969 11 ай бұрын
even after 4 years I was compelled to go through your videos. You are just the best. I remember learning Django from your videos back in the days. And still now i find your videos to be the best.
@systemslave510
@systemslave510 4 жыл бұрын
I dont care how long the video is as long as its thorough and comprehensive.
@sultanabbas9411
@sultanabbas9411 4 жыл бұрын
WOW, I've just set up my mind to learn some Panda then suddenly your video pops up, the fact that you have uploaded about Panda and Matplotlib is insane, You REALLY upload every Python related stuff Appreciated man, thanks
@rhard007
@rhard007 4 жыл бұрын
Corey, don't change anything. If YOU feel the video is too long, just release part 1 and part 2 of that topic. The content is great.
@safakv60
@safakv60 9 ай бұрын
i've latelty completed couple different pandas tutorials, even very deep one. however, this playlist is the simplest and the most effective one, even i just tend to refresh my knowledge. thanks a lot.
@bobmcgee6711
@bobmcgee6711 4 жыл бұрын
Corey take as long as you need in your videos. You're a great teacher.
@gethsun1
@gethsun1 4 жыл бұрын
Thank you very much Corey you creating very immense impact in peoples lives...
@coreyms
@coreyms 4 жыл бұрын
Thank you for the kind words. I'm happy to hear that people find these helpful.
@jingpinhuicai
@jingpinhuicai 4 жыл бұрын
Absolutely the best Pandas tutorial on KZbin!
@HellenofTroy897
@HellenofTroy897 2 жыл бұрын
Your tutorials are the best online. Just take notes, practise with them and do the documentation. Rinse and repeat.
@carneica
@carneica 5 ай бұрын
Your pedagogic skills are awesome! Every time I'm studying a new topic I read the official doc (also great) and then I search a related video from your channel... you make it look so simple and effective! Great tutorials!
@salmansiddiqui9502
@salmansiddiqui9502 6 ай бұрын
Thank you! This series has been incredibly helpful-clear, informative, and lucid. Your comment made me laugh as well! 🙂
@parthrawri3001
@parthrawri3001 4 жыл бұрын
Corey. You are the best. This content is a national treasure and must be preserved. I can’t stress enough how much of a change you’re making in other people’s lives. Keep doing the good work! Love from India ❤️ As far as the length is concerned, I really don’t mind how long it is. You make every second count, so that compensates for everything.
@evertonbarbosa8525
@evertonbarbosa8525 4 жыл бұрын
Mano, I'm Brazilian and I was trying to define a classification with two parameters and a specific order for each one, the video opened my eyes!
@yashbhoyar7889
@yashbhoyar7889 4 жыл бұрын
Cant believe that these lectures are free of cost.....
@patrikmerla8828
@patrikmerla8828 4 жыл бұрын
Once more great content, some of your videos are shown as teaching material in business schools in Finland!
@VikasGuptacherie
@VikasGuptacherie 4 жыл бұрын
No doubt about that ... I refer his tutorials to all my reportees in my organization to learn python ...
@quantumCollapses
@quantumCollapses 2 жыл бұрын
i don't know when you gonna read my comment, but believe it you're an awesome teacher ever!!!! You always tried to make videos useful and simple to understand even if someone wouldn't able to know English correctly, he can understand your teaching way. love from Afghanistan ❤
@sarathy319
@sarathy319 4 жыл бұрын
Python (Data structures & Algorithms ) - Much needed content from your channel
@rajeevmenon5945
@rajeevmenon5945 4 жыл бұрын
Some great people like you find teaching a bliss. Just unbelievable that such valuable lessons for FREE. Heartfelt Thanks for all the videos. God Bless you always
@khahmed4752
@khahmed4752 4 жыл бұрын
done 7 videos in a row without a break. You are awesome man
@homodeus-k9f
@homodeus-k9f 4 жыл бұрын
You are sponsored by Brilliant because you are brilliant!!!
@TariqTheTutor
@TariqTheTutor 2 жыл бұрын
best coding channel on KZbin!
@milrione8425
@milrione8425 4 жыл бұрын
You are the best programming teacher on youtube. I wished I found you earlier. Thank you so much. You are a great teacher!
@Clout_chasing_boy
@Clout_chasing_boy Жыл бұрын
What a phenomenal teacher.
@neelio99
@neelio99 4 жыл бұрын
Thank you for your hard work! Following your tutorials is such a great way to make use of my quarantine.
@mostafazohary4738
@mostafazohary4738 3 жыл бұрын
you are great corey.clear explanation that any one with no knowledge can learn
@sinanyagcoglu3233
@sinanyagcoglu3233 3 жыл бұрын
I cannot thank you enough! Fantastic content and teaching style! Keep up the good work Corey!
@zahrabardestani5546
@zahrabardestani5546 3 жыл бұрын
You are undoubtfully great , I fall in love with Pandas only due to your excellent teaching method
@dipayanroy8357
@dipayanroy8357 4 жыл бұрын
hey, brilliant series!! please do not shorten the length of the videos and take as much time and space you want. we like every little details you provide in there
@FrankMozingo
@FrankMozingo 4 жыл бұрын
Great series, which is not surprising... I have learned immensely from many of your videos and playlist! Your instruction is so good I am able to learn even by listening to your videos while driving (listen not watch, safety first you know). I would like to join the many others by saying thank you for the effort you put forth to produce you content!!
@MrLiohman
@MrLiohman 4 жыл бұрын
Hey Corey, I thought that you'll skip the joke about 2 mil salary, but no you did it. Kudos to you! Also, thanks you putting in all the effort in making these pandas tutorials. If lady luck get on my side and I start billion dollars company I shall probably hire you on a competitive salary (say 2 million). Cheers!
@brandibooth
@brandibooth Жыл бұрын
Your work on here is absolutely amazing. Thank you SO much! I really get it, the way you teach it. Thank you Corey!
@darkmaraux
@darkmaraux 4 жыл бұрын
Just perfect! Best teacher! Huge hug for ya!
@anantgosai8884
@anantgosai8884 3 жыл бұрын
Man you deserve more and more love&success....means alot bro,thankkkk you!
@aanalpatel5361
@aanalpatel5361 2 жыл бұрын
Thank you Corey Sir! The videos are veryyyyy helpful to beginners. Explained in the most simple manner, with loaddssss of examples . Thanks to the sponsores too!
@axisinfo819
@axisinfo819 3 жыл бұрын
Couldn't have asked for more. This is awesome!
@slikshot6
@slikshot6 4 жыл бұрын
Bro can I say, I'm really thankful for you putting all this out. It means a lot and its been taught very well.
@ishanpand3y
@ishanpand3y 4 жыл бұрын
Number 7 done. Thank you, sir!
@mitchellfolbe8729
@mitchellfolbe8729 3 жыл бұрын
Well done. Just doing this for a fun hobby. Thank you for keeping it interesting.
@Imrannaseem818
@Imrannaseem818 4 жыл бұрын
many thanks sir. dont worry about hte lenght ..... everything from you is acceptable
@stressfreetrading1341
@stressfreetrading1341 4 жыл бұрын
Love From India
@muralidhar40
@muralidhar40 Жыл бұрын
Corey, 2 Million is not everything in life. Chasing happiness with higher salaries is like chasing a Mirage. The run will not stop, The thirst will not be quenched!. However being in a state of Flow is the closest thing to happiness. Pl. look into advaita vedanta. Thanks for a wonderful exposition of Pandas.
@ithinkthereforeitalk935
@ithinkthereforeitalk935 Жыл бұрын
Why, I personally know how much money I need to stop being a part of a rat race. Many people just have no idea what their number is, how to manage their money properly and if that number is gonna really be enough to maintain the lifestyle they aspire to. Once you honestly answer all these questions you'll know precisely what to do and how. The problem is almost everybody is just dreaming of some amazing life if the future but it's just a dream, they have no clearly defined goals in mind.
@richardfichera2971
@richardfichera2971 4 жыл бұрын
Adding to the chorus here - make each section as long as you think you need to for the material you want to cover. As others have noted, there are pause and fast forward controls for us to use to play with. BTW, haven't downloaded the data yet, but as the sorted rows scrolled by, it looked like the $2M comp people entered annual salaries and indicatee they were weekly, which would convert to a very high annual salary.
@Zdshh12
@Zdshh12 4 жыл бұрын
Best Mentor i have ever seen
@mehdi-vl5nn
@mehdi-vl5nn 4 жыл бұрын
Please cover topics like async await sync(first comment btw)
@jasonxiao2456
@jasonxiao2456 4 жыл бұрын
As good as usual! Corey rock!
@KonradTamas
@KonradTamas Жыл бұрын
Great video! Although as a noob, I dont understand how we could sort multiple columns at the same time, because in my mind a Row = an Entry of data. So if we mess up the Row's data by arranging the columns in multiple ways. How we dont mess up the whole data and their Entries ???
@nemplayer1776
@nemplayer1776 2 ай бұрын
I know it's an old comment but here's a quick explanation. You firstly sort by the first value completely, then you see if there are duplicates (like two of the same, in his example to last names of "Doe"), then for only those duplicates you add an additional sort for a different value. All unique first values get untouched though.
@janidelemmanuelcastaneda8318
@janidelemmanuelcastaneda8318 4 жыл бұрын
Thank you so much! Your lessons have been very helpful. May I suggest to create a series on statistics using Python and Pandas? Thanks!
@rodkrebs9140
@rodkrebs9140 3 жыл бұрын
Very clear! excellent video
@marcusagrippa7584
@marcusagrippa7584 4 жыл бұрын
I do not believe in any religion but from now you are my prophet. Best teacher ever.
@donnybegins8629
@donnybegins8629 4 жыл бұрын
at 12:25 How can I get only particular columns like Country and Hobbyist for nlarget(10) using a filter?
@riteshkumar-ve3hs
@riteshkumar-ve3hs 3 жыл бұрын
Try this - survey_df[['Country ', 'Hobbyist ', 'ConvertedComp']].nlargest(10, 'ConvertedComp')
@ABDULKARIMHOMAIDI
@ABDULKARIMHOMAIDI Ай бұрын
Thanks man you're a life saver ..
@rodhash
@rodhash 4 жыл бұрын
Sir your vids are insanely good I wouldn't care if they get 4h long .. you're doing such an outstanding job here and people still complain.. that's crazy .. btw those 2M a year seems weird, dont they? I mean, many entries like that.. Is this just me or it seems buggy data?? Or perhaps people trolling in the survey
@mohit7717
@mohit7717 4 жыл бұрын
You are best sir i seen most of the lecture ,please upload more on related to data science courses , Thanks a lot sir
@YeekyYeeky
@YeekyYeeky 4 жыл бұрын
best tutorial video , thank you very much , longer video is ok
@Blazzzerr
@Blazzzerr 11 ай бұрын
I love your videos they help me in my study ❤
@karishmakaris7165
@karishmakaris7165 4 жыл бұрын
sir ur too great, thanks for ur efforts..
@pankajvasudeva1952
@pankajvasudeva1952 4 жыл бұрын
First of all thanks to you for sharing this knowledge. I am new in Python and starting working on excel files using pandas. In my code I have to read multiple files ,then to combine I am taking one sheet as master and looping through its values and finding other database. But it makes my code very slow and it took around 01:00 hour to complete all code. How can I make it faster.
@Pbuilder
@Pbuilder 3 жыл бұрын
Suppose you were matching a list to a string, and there were multiple results for that string. For example list 1 is for holidays, and list 2 is for seasons. The string is: "Christmas shoes for the winter" this would match both holidays list, and seasons list. Is there a way to show Holidays and Seasons horizontally? As of now, I can match multiple values, but they return vertically.
@qianyu711
@qianyu711 4 жыл бұрын
Corey, this is amazing. Thank you!
@jaitiwari241
@jaitiwari241 3 жыл бұрын
Sir u r great.. Please Also make a series on statistics for data science
@maciekpaciarski9343
@maciekpaciarski9343 4 жыл бұрын
Do you have plans to do metaprogramming and abstract classes tutorials in the near future? Respect for existing materials.
@darkknight8207
@darkknight8207 2 жыл бұрын
Very helpful sir! thank you
@letsjoinhands
@letsjoinhands 3 жыл бұрын
Hi Corey. I don't who gave you the idea to cut videos to a shorter time but your longer videos were excellent as well. Your grasp of the subject and it's concepts is so good that one forgets how long the video is. And how you chain it all together and present it is marvelous. Anyway what I wanted to say was that if a longer video has sub-topics for which we can see the time range does it even matter if it's long?? You have a fan here in Karachi, Pakistan btw. Stay cool and stay blessed.
@usern2473
@usern2473 Жыл бұрын
Hey Corey Can you share videos on : data comparison b/w two dataframes using pandas data comparison b/w two dataframes having some complex logics
@vyishakdl3950
@vyishakdl3950 4 жыл бұрын
if we set the data on he basis of first the index wiil be jumbeled what should we do keep the sort on the basis of first but the index should be in order
@guyindisguise
@guyindisguise 4 жыл бұрын
Does shorter videos mean more videos? Because I like whichever option gives us more total content. ;) PS: another great video. I've used Pandas for a project in the last few days and your videos have been a tremendous help. Thx Corey
@mahery_ranaivoson
@mahery_ranaivoson 4 жыл бұрын
Would it possible to follow this one by grouping techniques and visualization? Thanks
@kankipatihemanth4156
@kankipatihemanth4156 4 жыл бұрын
Hello Corey, could you do series on machine learning tutorials. Many people would highly appreciate that! Python tutorials are awesome.
@AylmerKing
@AylmerKing 4 жыл бұрын
Thank you for all your hard works!
@deepakk8758
@deepakk8758 4 жыл бұрын
Hi Sir, If possible on pandas-datareader library
@ironpolux
@ironpolux 3 жыл бұрын
Thanks for the vid, great video as usual :)
@vamsikrishna4107
@vamsikrishna4107 4 жыл бұрын
Thankyou ❤
@pilloblah
@pilloblah 4 жыл бұрын
Love your videos Corey, really informative. Dropping a HUGE like for the joke on the 2M dollars! Keep it up, I appreciate your content a lot!
@noureddineettayyeby5210
@noureddineettayyeby5210 4 жыл бұрын
Thank you for this Series.
@Diallo268
@Diallo268 4 жыл бұрын
So I just found out and I thought I'd share it. You can run a Jupyter notebook in VS code. Ctrl+Shift+P and open 'Python: Open Start Page'. If you don't see it there you probably need a plugin.
@Worldnme
@Worldnme 4 жыл бұрын
make a series on Tensorflow and Keras please
@Nohope__
@Nohope__ Жыл бұрын
it's crazy how anything can be done in pandas.
@shobhitsadwal756
@shobhitsadwal756 3 жыл бұрын
hello,can anybody help me with a small doubt actually i am trying to sort two columns , the "first" column is name and the "last" column contains integers , i have executed the command dff.sort_values(by=["first","last"],ascending=[False,True]) but i can only see change in the first column , the second column is not sorting in ascending order. what should i do?
@Thou_art777
@Thou_art777 Жыл бұрын
God bless you Corey
@МаксимВасильків-к3о
@МаксимВасильків-к3о 2 жыл бұрын
hi there! if largest values are identical like here, they would be taken from smallest index to largest, just like they are in a dataframe , right? Then why Respondent index in not in ascending order?
@samratsengupta8881
@samratsengupta8881 4 жыл бұрын
Hi Corey, if we want to specify the name of the country then, how to do that, please explain
@lyricathelyricsworld8945
@lyricathelyricsworld8945 3 жыл бұрын
Hey sir, We mainly need knowledge, so let video be long or short, it doesn't matter for gaining the knowledge. So please make videos irrespective of the timeline. Thank you......
@priyamishra323
@priyamishra323 4 жыл бұрын
Can you please make a video on boto3
@mrshaikyezdanirizwanipe5016
@mrshaikyezdanirizwanipe5016 4 жыл бұрын
df.sort_values(by = 'ConvertedComp',ascending = False) by doing this , cant we do the sorting for Salaries ??
@probhakarsarkar2430
@probhakarsarkar2430 3 жыл бұрын
Awesome course, 2million dollars are those people who downvote without comment 😂
@johngriner7339
@johngriner7339 4 жыл бұрын
looking for the link to the dataset
@AugustoGeografo
@AugustoGeografo 4 жыл бұрын
Dear, Corey Would it be possible for you to develop a tutorial on how to use locale through the data Analysis workflow? It's not adequate for us who live outside English speaking countries to present reports with float points instead of float commas. Nonetheless, the intricacies of using locale with pandas and matplotlib are not well covered in any course in English.
@johngriner7339
@johngriner7339 4 жыл бұрын
Looking for the link to the data set, please help
@finnmccool8671
@finnmccool8671 4 жыл бұрын
Hi Corey. A way off topic question. Do you ever use inline CSS in markdown cells in Jupyter notebooks for presentation purposes? I mean something like this: Introduction Or is there a way to apply a CSS style sheet for the whole notebook?
@tomchandler2356
@tomchandler2356 4 жыл бұрын
Hi Corey, love your videos. Can you please do video on async/await/asyncio.
@atulkumar7030
@atulkumar7030 4 жыл бұрын
How to get only selected columns like country and careerstats on using nlargest? right now using df we get entire df but I need only a particular column
@sharmakartikeya
@sharmakartikeya 3 жыл бұрын
We want longer videos if you feel it is important. Plain and Simple
@CatBlack01
@CatBlack01 4 жыл бұрын
Hi Corey, great series! At 6.21 when sorting one column I'm curious as to why 3 Doe is at the top, is it because we'd previously overwritten the original df with the sort by last and first?
@neerajpathak7585
@neerajpathak7585 4 жыл бұрын
Hi Corey , the videos that you have explained for explaining python and pandas are so explanatory and I would recommend it to everyone.I just wish you would explain the concepts of machine learning in python someday coz I don't want it to learn from any other source currently.Great work !!
Cat mode and a glass of water #family #humor #fun
00:22
Kotiki_Z
Рет қаралды 42 МЛН
How Strong Is Tape?
00:24
Stokes Twins
Рет қаралды 96 МЛН
人是不能做到吗?#火影忍者 #家人  #佐助
00:20
火影忍者一家
Рет қаралды 20 МЛН
Matplotlib Tutorial (Part 7): Scatter Plots
21:24
Corey Schafer
Рет қаралды 182 М.
Merging DataFrames in Pandas | Python Pandas Tutorials
22:09
Alex The Analyst
Рет қаралды 121 М.
Complete Python Pandas Data Science Tutorial! (2024 Updated Edition)
1:34:11
Exploratory Data Analysis with Pandas Python
40:22
Rob Mulla
Рет қаралды 511 М.
Cat mode and a glass of water #family #humor #fun
00:22
Kotiki_Z
Рет қаралды 42 МЛН