I have the input dataframe:
df1 = pandas.DataFrame( {
"Name" : ["Alice", "Bob", "Mallory", "Mallory","Mallory", "Bob" ,"Bob", "Mallory", "Alice"] ,
"City" : ["Seattle", "Seattle", "Portland", "Seattle", "Seattle", "Portland", "Portland", "Seattle", "Seattle"] } )
And I want to groupby Name, but not unique, so the output should be:
["Alice","Bob","Mallory","Bob","Mallory", "Alice"]
I couldn't find any efficient way to do it - is there a way without iterating all rows?