title: Pandas - Counting the number of days for group by
body: <p>I want to count the number of days after grouping by 2 columns:</p>
  
  <pre><code>groups = df.groupby([df.col1,df.col2])
  </code></pre>
  
  <p>Now i want to count the number of days relevant for each group:</p>
  
  <pre><code>result = groups['date_time'].dt.date.nunique()
  </code></pre>
  
  <p>I'm using something similar when I want to group by day, but here I get an error:</p>
  
  <blockquote>
    <p>AttributeError: Cannot access attribute 'dt' of 'SeriesGroupBy' objects, try using the 'apply' method</p>
  </blockquote>
  
  <p>What is the proper way to get the number of days?</p>