title: Renaming Column Names in Pandas Groupby function
body: <h1>Q1) I want to do a groupby, SQL-style aggregation and <strong>rename the output column</strong>:</h1>
  
  <p>Example dataset:</p>
  
  <pre><code>&gt;&gt;&gt; df
      ID     Region  count
  0  100       Asia      2
  1  101     Europe      3
  2  102         US      1
  3  103     Africa      5
  4  100     Russia      5
  5  101  Australia      7
  6  102         US      8
  7  104       Asia     10
  8  105     Europe     11
  9  110     Africa     23
  </code></pre>
  
  <p>I want to group the observations of this dataset by <code>ID</code> and <code>Region</code> and summing the <code>count</code> for each group. So I used something like this...</p>
  
  <pre><code>&gt;&gt;&gt; print(df.groupby(['ID','Region'],as_index=False).count().sum())
  
      ID     Region  count
  0  100       Asia      2
  1  100     Russia      5
  2  101  Australia      7
  3  101     Europe      3
  4  102         US      9
  5  103     Africa      5
  6  104       Asia     10
  7  105     Europe     11
  8  110     Africa     23
  </code></pre>
  
  <p>On using <code>as_index=False</code> I am able to get "SQL-Like" output. My problem is that I am unable to <strong>rename the aggregate variable <code>count</code></strong> here. So in SQL if wanted to do the above thing I would do something like this:</p>
  
  <pre><code>select ID, Region, sum(count) as Total_Numbers
  from df
  group by ID, Region
  order by ID, Region
  </code></pre>
  
  <p>As we see, it's very easy for me to <strong>rename the aggregate variable <code>count</code></strong> to <code>Total_Numbers</code> in SQL. I wanted to do the same thing in Pandas but unable to find such an option in group-by function. Can somebody help?</p>
  
  <p>The second question (more of an observation) is whether...</p>
  
  <h1>Q2) Is it possible to directly use column names in Pandas dataframe functions without enclosing them in quotes?</h1>
  
  <p>I understand that the variable names are strings, so have to be inside quotes, but I see if use them outside dataframe function and as an attribute we don't require them to be inside quotes. Like <code>df.ID.sum()</code> etc. It's only when we use it in a DataFrame function like <code>df.sort()</code> or <code>df.groupby</code> we have to use it inside quotes. This is actually a bit of pain as in SQL or in SAS or other languages we simply use the variable name without quoting them. Any suggestion on this? </p>
  
  <p>Kindly reply to both questions (Q1 is the main, Q2 more of an opinion).</p>