title: How to do data analysis (like counts, ucounts, frequency) with pandas?
body: <p>I have DataFrame like below:</p>
  <pre><code>df = pd.DataFrame([
      (&quot;i&quot;, 1, 'GlIrbixGsmCL'),
      (&quot;i&quot;, 1, 'GlIrbixGsmCL'),
      (&quot;i&quot;, 1, '3IMR1UteQA'),
      (&quot;c&quot;, 1, 'GlIrbixGsmCL'),
      (&quot;i&quot;, 2, 'GlIrbixGsmCL'),
  ], columns=['type', 'cid', 'userid'])
  </code></pre>
  <p><strong>Expected output like:</strong>
  <a href="https://i.stack.imgur.com/tRSF4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tRSF4.png" alt="expect output" /></a></p>
  <p><strong>For more details:</strong></p>
  <pre><code>i_counts, c_counts      =&gt; df.groupby([&quot;cid&quot;,&quot;type&quot;]).size()
  i_ucounts, c_ucounts    =&gt; df.groupby([&quot;cid&quot;,&quot;type&quot;])[&quot;userid&quot;].nunique()
  i_frequency,u_frequency =&gt; df.groupby([&quot;cid&quot;,&quot;type&quot;])[&quot;userid&quot;].value_counts()
  </code></pre>
  <p>Looks it's a little complex for me, how to do with pandas to get the expected result?</p>
  <p><strong>The related screenshots:</strong>
  <a href="https://i.stack.imgur.com/jjxJa.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jjxJa.png" alt="screenshots" /></a></p>