擅长:python、mysql、java
<p>尝试使用<a href="https://pandas.pydata.org/docs/reference/api/pandas.Series.str.replace.html" rel="nofollow noreferrer">^{<cd1>}</a>+<a href="https://pandas.pydata.org/docs/reference/api/pandas.Series.str.isdigit.html" rel="nofollow noreferrer">^{<cd2>}</a>创建一个掩码</p>
<pre><code>df['contact'] = df.contact.str.replace('-', '')
mask = df.contact.str.isdigit() # boolean mask
df[mask], df[~mask]
</code></pre>