<p>我有一个熊猫数据帧:</p>
<pre><code>id value
14 122
15 120
16 190
17 490
18 328
19 309
20 323
</code></pre>
<p>我有一个id的列表<code>L = [14,17,20]</code>,我想做两件事:</p>
<blockquote>
<p>Get the list of indexes of those rows where for the id's is not in the list L</p>
<p>i.e.( index of rows 15,16,18,19)</p>
</blockquote>
<p>而且</p>
<blockquote>
<p>Delete the rows for the id's is not in the list L.</p>
</blockquote>
<p>我的预期产出:</p>
^{pr2}$