title: KeyError: in pandas when trying to change boolean column values into string while using .loc method
body: <p>I am running a conditional loop to create a new column in my DataFrame (TDF) based on the value of column "alone". 
  If the value is 0, add the string "alone" else add "with family" in the column "alone". 
  I am using the code:
  I am getting the error:</p>
  
  <pre><code>tdf['alone'].loc[['alone'] &gt;0]= 'with family'
  tdf['alone'].loc[['alone'] ==0] = 'alone'
  </code></pre>
  
  <p>After running the above line, I am getting the following error:  </p>
  
  <pre><code>KeyError: 'cannot use a single bool to index into setitem'
  </code></pre>
  
  <p>I referred this <a href="https://stackoverflow.com/questions/33817842/keyerror-when-using-boolean-filter-on-pandas-data-frame">same question</a>, and what I gathered is that I need to have <code>row_indexer</code> in <code>tdf['alone'].loc[[row_indexer,['alone']] = 'alone'</code> but I am not sure how to get the values in <code>row_indexer</code></p>