title: Pandas, creating a column based on ranges
body: <p>I am trying to create a new column based on the condition of another column, with ranges of that count. However, I am getting a ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().</p>
  <p>I am trying to use the same column twice to make the range, but it does not work. Where is the problem?</p>
  <pre><code>df.loc[(df[&quot;count_words&quot;] &gt; 100 &amp; df[&quot;count_words&quot;] &lt;= 300),  &quot;length&quot;] = &quot;keskipitkä&quot;
  df.loc[df[&quot;count_words&quot;] &lt;= 100, &quot;lenght&quot;] = &quot;lyhyt&quot;
  df.loc[df[&quot;count_words&quot;] &gt; 300,  &quot;length&quot;] = &quot;pitkä&quot;
  </code></pre>