title: ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all() with .loc
body: <p>Given the following pandas DataFrame -</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th><strong>json_path</strong></th>
  <th><strong>Reporting Group</strong></th>
  <th><strong>Entity/Grouping</strong></th>
  <th><strong>Entity ID</strong></th>
  <th><strong>Adjusted Value (Today, No Div, USD)</strong></th>
  <th><strong>Adjusted TWR (Current Quarter, No Div, USD)</strong></th>
  <th><strong>Adjusted TWR (YTD, No Div, USD)</strong></th>
  <th><strong>Annualized Adjusted TWR (Since Inception, No Div,   USD)</strong></th>
  <th><strong>Adjusted Value (No Div, USD)</strong></th>
  <th><strong>TWR Audit Note</strong></th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>data.attributes.total.children.[0].children.[0].children.[0]</td>
  <td>Barrack Family</td>
  <td>William and Rupert Trust</td>
  <td>9957007</td>
  <td>-1.44</td>
  <td></td>
  <td></td>
  <td></td>
  <td>-1.44</td>
  <td></td>
  </tr>
  <tr>
  <td>data.attributes.total.children.[0].children.[0].children.[0].children.[0]</td>
  <td>Barrack Family</td>
  <td>Cash</td>
  <td>-</td>
  <td>-1.44</td>
  <td></td>
  <td></td>
  <td></td>
  <td>-1.44</td>
  <td></td>
  </tr>
  <tr>
  <td>data.attributes.total.children.[0].children.[0].children.[1]</td>
  <td>Barrack Family</td>
  <td>Gratia   Holdings No. 2 LLC</td>
  <td>8413655</td>
  <td>55491732.66</td>
  <td>-0.971018847</td>
  <td>-0.971018847</td>
  <td>11.52490309</td>
  <td>55491732.66</td>
  <td></td>
  </tr>
  <tr>
  <td>data.attributes.total.children.[0].children.[0].children.[1].children.[0]</td>
  <td>Barrack Family</td>
  <td>Investment   Grade Fixed Income</td>
  <td>-</td>
  <td>18469768.6</td>
  <td></td>
  <td></td>
  <td></td>
  <td>18469768.6</td>
  <td></td>
  </tr>
  <tr>
  <td>data.attributes.total.children.[0].children.[0].children.[1].children.[1]</td>
  <td>Barrack Family</td>
  <td>High   Yield Fixed Income</td>
  <td>-</td>
  <td>3668982.44</td>
  <td>-0.205356545</td>
  <td>-0.205356545</td>
  <td>4.441190127</td>
  <td>3668982.44</td>
  <td></td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>I am trying to filter on rows that != <code>Cash</code> (<code>'Entity/Grouping'</code> column) and that have a blank value in <code>'Adjusted TWR (Current Quarter, No Div, USD)'</code> column, <code>'Adjusted TWR (YTD, No Div, USD)'</code> column or <code>'Annualized Adjusted TWR (Since Inception, No Div, USD)'</code> column.<br><br><strong>Code:</strong> I am trying to achieve this by the following code - <br></p>
  <pre><code>perf_asset_class_df = df[df['json_path'].str.contains(r'(?:\.children\.\[\d+\]){4}')]
  perf_asset_class_df.loc[(perf_asset_class_df['Entity/Grouping']!= 'Cash') &amp; 
                          (perf_asset_class_df['Adjusted TWR (Current Quarter, No Div, USD)'] == '') or
                          (perf_asset_class_df['Adjusted TWR (YTD, No Div, USD)'] == '') or
                          (perf_asset_class_df['Annualized Adjusted TWR (Since Inception, No Div, USD)'] == '')]
  return perf_asset_class_df
  </code></pre>
  <p><strong>Issue:</strong> I am receiving the following error, which points to an issue with <code>perf_asset_class_df.loc[(perf_asset_class_df['Entity/Grouping']!= 'Cash')...</code></p>
  <pre><code>ValueError                                Traceback (most recent call last)
  C:\Users\WILLIA~1.FOR\AppData\Local\Temp/ipykernel_18756/2689024934.py in &lt;module&gt;
       48     writer.save()
       49 
  ---&gt; 50 xlsx_writer()
  
  C:\Users\WILLIA~1.FOR\AppData\Local\Temp/ipykernel_18756/2689024934.py in xlsx_writer()
        1 # Function that writes Exceptions Report and API Response as a consolidated .xlsx file.
        2 def xlsx_writer():
  ----&gt; 3     reporting_group_df, unknown_df, perf_asset_class_df, perf_entity_df, perf_entity_group_df = twr_exceptions_logic()
        4 
        5 #   Creating and defining filename for exceptions report
  
  C:\Users\WILLIA~1.FOR\AppData\Local\Temp/ipykernel_18756/1522996685.py in twr_exceptions_logic()
        4 #   [LOGIC] FOR PERF. BY ASSET CLASS (EX. ILLIQUID) - STANDARD REPORT PG.4
        5     perf_asset_class_df = df[df['json_path'].str.contains(r'(?:\.children\.\[\d+\]){4}')]
  ----&gt; 6     perf_asset_class_df.loc[(perf_asset_class_df['Entity/Grouping']!= 'Cash') &amp; 
        7                             (perf_asset_class_df['Adjusted TWR (Current Quarter, No Div, USD)'] == '') or
        8                             (perf_asset_class_df['Adjusted TWR (YTD, No Div, USD)'] == '') or
  
  ~\.conda\envs\JPDevelopment\lib\site-packages\pandas\core\generic.py in __nonzero__(self)
     1533     @final
     1534     def __nonzero__(self):
  -&gt; 1535         raise ValueError(
     1536             f&quot;The truth value of a {type(self).__name__} is ambiguous. &quot;
     1537             &quot;Use a.empty, a.bool(), a.item(), a.any() or a.all().&quot;
  
  ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
  </code></pre>
  <p>I am having a terrible run of making some amateur mistakes, and wondered if someone can give me a hint where I'm going wrong?</p>