Pandas: Sort within groups

Photo by Mika Baumeister on Unsplash

Here is an example of reading data from csv file using pandas, group the data by values in one column and sort them by values in another column but within those groups.

The objective is to group the rows by Project Name and then sort them by their corresponding Submission Dates.

This can be achieved in a single line of pandas code.
1. Sort Project Name column alphabetically to sort the groups in a certain order.

2. Group by Project Name

3. Sort within each group by Submission Date

Here is code to read and write the csv file after sorting.

Sorted data is shown below.

Computer Vision | Machine Learning | Deep Learning https://arccoder.github.io/

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store