Ordering results by a column in SQL, translated to Python's pandas
Ordering data by one column in pandas
In SQL:
SELECT
*
FROM
table
ORDER BY
column_1;
In pandas:
table
.sort_values('column_1', ascending=True)
Ordering data by multiple columns in pandas
In SQL:
SELECT
*
FROM
table
ORDER BY
column_1 DESC,
column_2 ASC;
In pandas:
table
.sort_values(['column_1', 'column_2'], ascending = [False, True])