title: pandas syntax for more complex sql query
body: <p>I am looking for pandas syntax to do following aggregation to Pandas DataFrame. I cannot find an example how to accomplish following sql query in pandas.</p>
  
  <pre><code>#sum and divide
  select
   click,
   ctr,
   SUM(click)/SUM(imp) as ctr
  from mytable
  group by website
  
  #normalize each subgroup 
  select
   imp,
   imp/SUM(imp) Over (partition website) as n_imp
  from mytable
  </code></pre>