I find the following Pandas code pretty easy to read:<p><pre><code>  (df
   .groupby([&#x27;a&#x27;, &#x27;b&#x27;, &#x27;c&#x27;], as_index=False)
   .agg({&#x27;d&#x27;: sum, &#x27;e&#x27;: mean, &#x27;f&#x27;, np.std})
   .assign(g=lambda x: x.a &#x2F; x.c)
   .query(&quot;g &gt; 0.05&quot;)
   .merge(df2, on=&#x27;a&#x27;))
</code></pre>
There are now methods in pandas to do pretty much anything, so you can chain them together into one easy-to-read manipulation without lots of intermediate variables.