title: Why there is an extra index when using apply in Pandas
body: <p>When I use <code>apply</code> to a user defined function in Pandas, it looks like python is creating an additional array. How could I get rid of it? Here is my code:</p>
  
  <pre><code>def fnc(group):
      x = group.C.values
      out = x[np.where(x &lt; 0)]
      return pd.DataFrame(out)
  
  data = pd.DataFrame({'A':np.random.randint(1, 3, 10),
                       'B':3,
                       'C':np.random.normal(0, 1, 10)})
  
  data.groupby(by=['A', 'B']).apply(fnc).reset_index()
  </code></pre>
  
  <p>There is this weird <code>Level_2</code> index created. Is there a way to avoid creating it when running my function?   </p>
  
  <pre><code>    A   B   level_2   0
  0   1   3   0        -1.054134802
  1   1   3   1        -0.691996447
  2   2   3   0        -1.068693768
  3   2   3   1        -0.080342046
  4   2   3   2        -0.181869799
  </code></pre>