擅长:python、mysql、java
<p>您可以将<a href="https://numpy.org/doc/stable/reference/generated/numpy.apply_along_axis.html" rel="nofollow noreferrer">^{<cd1>}</a>与<a href="https://numpy.org/doc/stable/reference/generated/numpy.unique.html" rel="nofollow noreferrer">^{<cd2>}</a>一起使用,然后我们创建一个布尔索引</p>
<pre><code>arr = df.filter(like='id').to_numpy().astype(str)
arr = np.apply_along_axis(np.unique, 1, arr)
m = (arr[1:]!=arr[:-1]).all(axis=1)
m = np.r_[False, m]
df[m]
email id1 id2 id3
0 de@l Z7 Q4 Q4
4 endo@c D8 D8 L1
</code></pre>