title: Apply function to Dataframe GroupBy Object and return dataframe
body: <p>How do I return a dataframe from a groupby object using Pandas? The intent here is to read in a CSV and replace each IP address in the IP address column with a value returned by randIP(). I'd like to do this by grouping to maintain consistency throughout the obfuscated dataframe afterwards (each real IP maps to a new random IP).</p>
  
  <p>I've tried numerous methods but this seems to be the most successful. self.df2 is printing as a pandas.core.grouby.SeriesGroupBy object.</p>
  
  <pre><code>def __init__(self, filename):
      self.df = pd.read_csv(filename)
      self.grouped = self.df.groupby('IP Address')
      self.df.reset_index(drop=True, inplace=True)
      for i, k in self.grouped:
          r = randIP()
          k['IP Address'] = k['IP Address'].apply(lambda x: x.replace(x, r))
      self.df2 = self.grouped
      print(self.df2['IP Address'])
  </code></pre>