#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Janice Cheng

import pandas as pd

df1 = pd.DataFrame( {
    "Name" : ["Alice", "Bob", "Mallory", "Mallory", "Bob" , "Mallory"] ,
    "City" : ["Seattle", "Seattle", "Portland", "Seattle", "Seattle", "Portland"],
    "score" : [4, 2, 3, 5, 6, 8] } )

# df1.rename(columns={'Name':'new_name','City':'new_city'},inplace=True)

df1 = df1.sort_values(['Name', 'City'], ascending=[1, 0])

g1 = df1.groupby(["City"]).size().max()
g2 = df1.groupby(["City"]).size()
df3 = g2.reset_index()
name = df3[df3[0] == g1]

print(name.set_index('City').index.values[0])
