Sql Rank Function Practice Python