title: How to combine groupby two times in pandas?
body: <p>I have a following problem. I have this dataframe:</p>
  <pre><code>df = pd.DataFrame({
      &quot;id_person&quot;: [&quot;10&quot;, &quot;10&quot;, &quot;11&quot;, &quot;11&quot;, &quot;11&quot;, &quot;10&quot;],
      &quot;date&quot;: [&quot;2021-08-30&quot;, &quot;2021-08-30&quot;, &quot;2021-08-30&quot;,&quot;2021-08-30&quot;,&quot;2021-08-31&quot;,&quot;2021-08-31&quot;,],
      &quot;some_value&quot;: [34, 1, 31, 9, 5, 12],
  })
  </code></pre>
  <p>I would like to compute for each day how many different people were working and how many rows are there for each day. I know how to compute each value separately and then to combine this into one dataframe using <code>pd.merge</code>. But is there more pythonic way?</p>
  <p>Desired output is:</p>
  <pre><code>df_output = pd.DataFrame({
      &quot;date&quot;: [&quot;2021-08-30&quot;, &quot;2021-08-31&quot;,],
      &quot;persons&quot;: [2, 2],
      &quot;count&quot;: [4, 2],
  })
  </code></pre>