``` >>> df1 = pd.DataFrame( { "Name" : ["Alice", "Bob", "Mallory", "Mallory", "Bob" , "Mallory"] , "City" : ["Seattle", "Seattle", "Portland", "Seattle", "Seattle", "Portland"] } ) >>> g1 = df1.groupby( [ "Name" ] ) >>> print g1.head() City Name Name Alice 0 Seattle Alice Bob 1 Seattle Bob 4 Seattle Bob Mallory 2 Portland Mallory 3 Seattle Mallory 5 Portland Mallory >>> g1.to_csv('out.csv') g1.to_csv('out.csv') Out[10]: Name Alice None Bob None Mallory None dtype: object ``` (Why some data are output to ipython console ?) ``` >>> !cat out.csv ,City,Name 2,Portland,Mallory 3,Seattle,Mallory 5,Portland,Mallory ```