擅长:python、mysql、java
<p>我们可以用</p>
<pre><code>df['Flag'] = df.apply(lambda x: str(x['Number']) in x['Items'],axis = 1)
</code></pre>
<p>或</p>
<pre><code>df['Flag'] = (df['Items'].str.split(',').explode()
.eq(df['Number']
.astype(str))
.any(level = 0) )
</code></pre>
<p><strong>输出</strong></p>
<pre><code> Number Items Flag
0 1 1,3,7 True
1 2 1,2,7 True
2 3 4,5 False
3 4 9 False
</code></pre>