Python Datatable Sort And Stack Puzzle