<p>您可以使用<code>pd.IntervalIndex</code>作为交叉点</p>
<p>获取要删除的行</p>
<pre><code>In [313]: dfr = df1.query('Remove == 1')
</code></pre>
<p>从要删除的范围构造IntervalIndex</p>
^{pr2}$
<p>构建待测试的IntervalIndex</p>
<pre><code>In [315]: s2 = pd.IntervalIndex.from_arrays(df2.Start, df2.End, 'both')
</code></pre>
<p>选择不在s1范围内的s2行</p>
<pre><code>In [316]: df2.loc[[x not in s1 for x in s2]]
Out[316]:
Start End
2 151 154
</code></pre>
<hr/>
<p>详细信息</p>
<pre><code>In [320]: df1
Out[320]:
Start End Remove
0 50 60 1
1 61 105 0
2 106 150 1
3 151 160 0
4 161 180 1
5 181 200 0
6 201 400 1
In [321]: df2
Out[321]:
Start End
0 55 100
1 105 140
2 151 154
3 155 185
4 220 240
In [322]: dfr
Out[322]:
Start End Remove
0 50 60 1
2 106 150 1
4 161 180 1
6 201 400 1
</code></pre>
<p>IntervalIndex详细信息</p>
<pre><code>In [323]: s1
Out[323]:
IntervalIndex([[50, 60], [106, 150], [161, 180], [201, 400]]
closed='both',
dtype='interval[int64]')
In [324]: s2
Out[324]:
IntervalIndex([[55, 100], [105, 140], [151, 154], [155, 185], [220, 240]]
closed='both',
dtype='interval[int64]')
In [326]: [x not in s1 for x in s2]
Out[326]: [False, False, True, False, False]
</code></pre>