title: Count observations per date and per date & category
body: <p>I need to explain one behavior of pandas.
  Suppose this dataframe:</p>
  <pre class="lang-py prettyprint-override"><code>index;day;id;value
  0;2020-01-03;1;14
  1;2020-01-03;1;2
  2;2020-01-03;2;5
  3;2020-01-05;1;7
  4;2020-01-05;1;9
  </code></pre>
  <p>When I want to compute number of observation per day and id I can simple do:</p>
  <pre><code>df[&quot;frequency_per_id&quot;] = df([&quot;id&quot;, &quot;day&quot;])[&quot;id&quot;].transform(&quot;count&quot;)
  </code></pre>
  <p>But when I want to compute the number of observations per day using the same formula:</p>
  <pre><code>df[&quot;frequency&quot;] = df([&quot;day&quot;])[&quot;day&quot;].transform(&quot;count&quot;)
  </code></pre>
  <p>I got an error <code>&lt;ipython-input-16-3a624d98b3b5&gt;:1: SettingWithCopyWarning:  A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead</code></p>
  <p>Can you explain me why? I do the same process? Thanks a lot</p>