擅长:python、mysql、java
<p>您可以将<a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.groupby.html#pandas-dataframe-groupby" rel="nofollow noreferrer">^{<cd1>}</a>与<code>.apply(list)</code>一起使用:</p>
<pre><code>df = pd.DataFrame({'Oligo_sequence':['ATG', 'ATG', 'CAG'], 'Plasmid':['Plasmid A', 'Plasmid B', 'Plasmid C']})
print(df.groupby('Oligo_sequence')['Plasmid'].apply(list).reset_index())
</code></pre>
<p>印刷品:</p>
<pre><code> Oligo_sequence Plasmid
0 ATG [Plasmid A, Plasmid B]
1 CAG [Plasmid C]
</code></pre>