title: How to use the new column name created on the same line of code in Pandas
body: <p>I have a <code>df</code></p>
  <p>and now I do this:</p>
  <pre><code>df.groupby(['StudentID', 'Major']).size().reset_index(name='Freq')
  </code></pre>
  <p>In the code above, I created a new column <code>Freq</code> which calculates the <em>frequency</em> of a combination of <code>StudentID</code> and <code>Major</code></p>
  <p>But now I want to get the data that has <code>Freq</code> of <code>1 or greater</code> on the same line.</p>
  <p>Eg:</p>
  <pre><code>df.groupby(['StudentID', 'Major']).size().reset_index(name='Freq')[df['Freq'] &gt; 1]
  </code></pre>
  <p>which does not work since the original <code>df</code> does not have <code>Freq</code> column.</p>
  <p>One possible way is to save the filtered value into a new DataFrame, lets say, <code>df2</code> and then filter using <code>df2[df2['Freq'] &gt; 1]</code> but I want to know if there is a way to use it in one line of code.</p>