title: ValueError: operands could not be broadcast together with shapes (6,) (0,) when trying to select rows in dataframe based on condition
body: <p>I have got a question refering to one of my last issues: <a href="https://stackoverflow.com/questions/53023549/keep-upper-n-rows-of-a-pandas-dataframe-based-on-condition">Keep upper n rows of a pandas dataframe based on condition</a>. Using the second suggested answer my code looks like that:</p>
  
  <pre><code>import pandas as  pd
  x=2
  y=2
  df2 = pd.DataFrame({'x':[1,2,3,4], 'y':[2,2,2,2],'id':[1,2,3,4]})
  df2_cut=df2[df2.index &lt;= (df2[(df2.x == x) &amp; (df2.y == y)]).index.tolist()]
  </code></pre>
  
  <p>This works fine too, it is just the same but having another dataframe there.</p>
  
  <pre><code>import pandas as  pd
  x=2
  y=2
  df1 = pd.DataFrame({'x':[2,2,2,2], 'y':[1,2,3,4],'id':[1,2,3,4]})
  df2 = pd.DataFrame({'x':[1,2,3,4], 'y':[2,2,2,2],'id':[1,2,3,4]})
  df1_cut=df1.iloc[((df1['x'] == x) &amp; (df1['y'] == y)).values.argmax():]
  df2_cut=df2[df2.index &lt;= (df2[(df1.x == x) &amp; (df2.y == y)]).index.tolist()]
  </code></pre>
  
  <p>Now what is weird and I do not understand is this:</p>
  
  <pre><code>import pandas as  pd
  x=2
  y=2                     #made a change here
  df1 = pd.DataFrame({'x':[1,2,2,2], 'y':[1,2,3,4],'id':[1,2,3,4]})
  df2 = pd.DataFrame({'x':[1,2,3,4], 'y':[2,2,2,2],'id':[1,2,3,4]})
  df1_cut=df1.iloc[((df1['x'] == x) &amp; (df1['y'] == y)).values.argmax():]
  df2_cut=df2[df2.index &lt;= (df2[(df1.x == x) &amp; (df2.y == y)]).index.tolist()]
  </code></pre>
  
  <p>It is just the same Code for as before but i switched the first <code>x</code> value of df1 to 1. This change throws me an error for df2, in the last row when shortening df2. How can that be? </p>
  
  <pre><code>---------------------------------------------------------------------------
  ValueError                                Traceback (most recent call last)
  &lt;ipython-input-121-72d9d78368b9&gt; in &lt;module&gt;()
  4 df1 = pd.DataFrame({'x':[1,1,1,2,6], 'y':[5,6,7,7,9],'id':[1,2,3,4,5]})
  5 df2 = pd.DataFrame({'x':[1,1,4,3,1,1], 'y':[1,1,5,9,2,2],'id':[1,2,3,103,22,90]})
  ----&gt; 6 df2_cut=df2[df2.index &lt;= (df2[(df1.x == x) &amp; (df2.y == y)]).index.tolist()]
  7 df1_cut=df1.iloc[((df1['x'] == x) &amp; (df1['y'] == y)).values.argmax():]
  
  ~/anaconda3/lib/python3.6/site-packages/pandas/core/indexes/base.py in _evaluate_compare(self, other)
  3844                 else:
  3845                     with np.errstate(all='ignore'):
  -&gt; 3846                         result = op(self.values, np.asarray(other))
  3847 
  3848                 # technically we could support bool dtyped Index
  
  ValueError: operands could not be broadcast together with shapes (6,) (0,) 
  </code></pre>
  
  <p>Anyone an idea how that happens or any other idea of how to solve my issue?
  If anyone has another idea of how to solve my issue i would be delighted to hear it. Basically I have two dataframes with <code>x-y</code> coordinates and <code>id</code> as columns. Now I want given a so called intersection point with an <code>x</code> and <code>y</code> value, to delete at dataframe 1 all rows that are under the row that fulfills the condition that <code>x</code> is equal to the <code>x-column</code>value and <code>y</code> is equal to the <code>y-column</code> value. For dataframe 2 just the same, but to delete the rows above the condition. That way I want to get 2 dataframes (one ends with the given <code>x-y coordinates</code>the other starts with it). I would like to append/concat to each other to get a new dataframe. The dataframes can have duplicates and it might happen that there are jumps like from coordinate (1,2) directly to (1,4) without the intermediate step (1,3)</p>
  
  <p>Here an example of what i would get for the above values:</p>
  
  <pre><code>df1_cut = pd.DataFrame({'x':[2,2], 'y':[1,2],'id':[1,2]})
  df2_cut = pd.DataFrame({'x':[2,3,4], 'y':[2,2,2],'id':[2,3,4]})
  df_list=[]
  df_list.append(df1_cut)
  df_list.append(df2_cut)
  df_final = pd.concat(df_list, ignore_index=True)
  </code></pre>
  
  <p>I want it to work with any dataframes.</p>