擅长:python、mysql、java
<p>请尝试使用下面的<code>startswith</code>,因为<code>startswith</code>允许将<strong>字符串</strong>或<strong>元组</strong>作为其第一个参数</p>
<pre><code>ds_4.loc[ds_4['Domain'].str.startswith(('Alcohol,animals,children,crime','Alcohol,campaign-finance,ethics,public-service','Alcohol,candidates-biography','Alcohol,candidates-biography,crime','Alcohol,children','Alcohol,children,crime,public-health,public-safety'), na=False), 'New_Domain'] = "Alcohol"
</code></pre>