擅长:python、mysql、java
<p>将<a href="https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#boolean-indexing" rel="nofollow noreferrer">^{<cd1>}</a>与<code>~</code>运算符(逻辑<strong>非</strong>)和<code>|</code>运算符(逻辑<strong>或</strong>)一起使用:</p>
<pre><code>df[~(df.Code.eq('Cat') | df.Code.shift(1).eq('Cat'))]
Code Int
0 Foo x
1 Bar y
4 Foo x
</code></pre>