擅长:python、mysql、java
<p>我认为您可以先创建dict of list,然后将<code>keys</code>与<code>values</code>交换为<code>d</code>和<a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.replace.html" rel="nofollow noreferrer">^{<cd4>}</a>:</p>
<pre><code>L = ['Hey how are you?',
'Hey is their anyway to find that',
'Hey is their a way to prove this',
'over their, hey, how are you?']
df = pd.DataFrame({'Statements':L})
A = {'1':['Hey', 'Hello', 'Hi', 'hey']}
d = {k: oldk for oldk, oldv in A.items() for k in oldv}
print (d)
{'Hi': '1', 'hey': '1', 'Hey': '1', 'Hello': '1'}
df['Statements'] = df['Statements'].replace(d, regex=True)
print (df)
Statements
0 1 how are you?
1 1 is their anyway to find that
2 1 is their a way to prove this
3 over their, 1, how are you?
</code></pre>