title: Convert pandas.core.groupby.SeriesGroupBy to a DataFrame
body: <p>This <a href="https://stackoverflow.com/questions/46807334/converting-pandas-core-groupby-seriesgroupby-to-dataframe">question</a> didn't have a satisfactory answer, so I'm asking it again. </p>
  
  <p>Suppose I have the following Pandas DataFrame:</p>
  
  <pre><code>df1 = pd.DataFrame({'group': ['a', 'a', 'b', 'b'], 'values': [1, 1, 2, 2]})
  </code></pre>
  
  <p>I group by the first column 'group':</p>
  
  <pre><code>g1 = df1.groupby('group')
  </code></pre>
  
  <p>I've now created a "<strong>DataFrame</strong>GroupBy". Then I extract the first column from the GroupBy object:</p>
  
  <pre><code>g1_1st_column = g1['group']
  </code></pre>
  
  <p>The type of g1_1st_column is "pandas.core.groupby.<strong>Series</strong>GroupBy". Notice it's not a "<strong>DataFrame</strong>GroupBy" anymore. </p>
  
  <p>My question is, how can I convert the SeriesGroupBy object back to a DataFrame object? I tried using the .to_frame() method, and got the following error:</p>
  
  <pre><code>g1_1st_column = g1['group'].to_frame()
  </code></pre>
  
  <p><strong>AttributeError</strong>: Cannot access callable attribute 'to_frame' of 'SeriesGroupBy' objects, try using the 'apply' method. </p>
  
  <p>How would I use the apply method, or some other method, to convert to a DataFrame?</p>