title: Pandas Data data frame filtering after using pivot function
body: <p>Can someone please help me with my current error or suggest another way of doing this ?
  Thanks a lot in advance</p>
  <p>I have bellow data frame given bellow :-</p>
  <pre><code>GroupName  Id     Type1     Type2      Type 3
  ABC         1       100       0            0
              2         0      -100          0 
              3         0       100         100
  DEF         4       100       0            0 
              5        0        100          0
  </code></pre>
  <p>I want to filter the data frame such that it returns me all the rows and the GroupName where one or more of the columns (Type1 /Type2/Type3) has +ve and a -ve value .</p>
  <p>OUTPUT in the above df it will return be only</p>
  <pre><code>GroupName  Id     Type1     Type2      Type 3
  ABC         1       100       0            0
              2         0      **-100**          0 
              3         0       100         **100**
  </code></pre>
  <p>I tried</p>
  <pre><code>df[df.gt(0).any(axis=1) &amp; df.lt(0).any(axis=1)]
  </code></pre>
  <p>getting error</p>
  <pre><code>    if level_codes[key] == -1:
  IndexError: index 0 is out of bounds for axis 0 with size 0
  </code></pre>
  <p>I created this df by using a pivot table</p>
  <pre><code>df= old_df.pivot_table(index=[&quot;GroupName&quot;,&quot;Id&quot;], columns=&quot;Type&quot;, values=&quot;Value&quot;,
                                                aggfunc=np.sum)
  </code></pre>