擅长:python、mysql、java
<p>使用<strong><a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.replace.html" rel="nofollow noreferrer">replace</a></strong>的一种方法是:获取与<&燃气轮机;并将它们与字典中的替换项配对</p>
<pre><code>outcome = filter.replace({'GAAP':"\<\d\>", 'CP':"\<\d\>"},
{"GAAP":"|".join(d['GAAP']), "CP":"|".join(d["CP"])},
regex=True)
GAAP CP
0 100|101 5
1 2 6
2 3 500|501|502
3 4 8
</code></pre>