How do I sort a pandas DataFrame or a Series?

preview_player
Показать описание
pandas allows you to sort a DataFrame by one of its columns (known as a "Series"), and also allows you to sort a Series alone. The sorting API changed in pandas version 0.17, so in this video, I'll demonstrate both the "old way" and the "new way" to sort. I'll also show you how to sort a DataFrame by multiple columns at once!

SUBSCRIBE to learn data science with Python:

JOIN the "Data School Insiders" community and receive exclusive rewards:

== RESOURCES ==

== LET'S CONNECT! ==
Рекомендации по теме
Комментарии
Автор

To add to the bonus tip, when you sort by multiple columns it is sorted ascending in each column by default. You can control the order for each column by passing a list against the 'ascending' argument like thus: movies.sort_values(['content_rating', 'duration'], ascending= [True, False]) - this way within the "APPROVED" eg, we would get the longest duration movies first.

asneogy
Автор

Hi Kevin, just wanted you to know people are still watching and benefiting from your pandas videos three years after you made them. Great job. And thanks!

belleriveblvd
Автор

You posted this 4 years back and this helped me today. Grear work bro. Appreciate it... 😊❤️😊

ahmarnaved
Автор

This guy has got cleanest of the videos. Voice is so pleasant to the ears with great explanation.

gauravagarwal
Автор

Dude I had to make a tool for work using Pandas and I wouldn't have been able to do it without your help. Your honestly one of the best youtube code teachers. Cheers man

CalCalCal
Автор

Thanks to Covid I'm taking the time to learn a new skill set and these videos are definitely helping me understand my assignments better. In fact, some of my assignments use the same datasets! Thanks so much for making them, what I miss or don't understand in class is offered here from another perspective <3 :)

asiahewett
Автор

Came here 5 years later and it helps me a lot. thank you so much man...

rafnishad
Автор

Hi Kevin, this is first series of ur channel that I'm watching, it is absolutely useful n informative, u hv taken evn minute details that we normally tend to skip, one more thing pls make video series on numpy and ML explain all models (if possible)... Thank you so much for these wonderful video... God bless!

ramleo
Автор

Amazing explanation. Clear, structured presentation from a highly experienced human 10/10

RAWRCoding
Автор

You videos are great because they are straight and simple to our doubts. Thanks man

FabioRBelotto
Автор

Kelvin, appreciate a lot! A comment from 2020, meet this amazing video from a sad year.

pengsiyu
Автор

Thanks Kevin for your instructional video, it is very clear and so easy to understand. I have subscribed and pressed the bell notification to see your future videos.

rajansomanathan
Автор

Thank you so much. Videos are very helpful and easy to understand.

PrinuTriesHerBest
Автор

I very much congratulate you for sharing code used in video with us. Many thanks for that. It is very much useful to me. My warm regards to you.

s.baskaravishnu
Автор

Its great dude. Job well done as always. By the way, if in case I want to pass multiple arguments/options for ascending for example to sort two columns both list " ascending=[True, False]" and tuple "ascending=(True, False)" form works without error. So, I was wondering which one form (list or tuple) should be preferred over the other?

mahboob
Автор

Kevin, your videos are very helpful. Thank you!

Kristina_Tsoy
Автор

Awesome! Love the way you explain things - thanks

ganeshbala
Автор

Just in one word. YOU ARE THANKS SO MUCH !!!

hpourmamih
Автор

Hey, you're work is really appreciated man and thanks for sharing such a nice videos man. I was checking all comments(to see If I could get this kind scenario) and got really alot of more options to explore. Could I compare two excel sheets for data analysis? a) From excel sheet 1 to excel sheet 2, how much new data arrived, b) How much old data carry forward to sheet 2, c) Percentage of change from old data carry forward( or new data) . In the two excel sheets, I would be comparing two or more columns to check on the change in the both files for new data as well as old carry forwarded data. - Thanks, advance man.

Vinay_Gurram
Автор

After the current time it's useful to me very much in the latest version 👍👍
Thanks broo😀😀❤️

josephthomas