回答此问题可获得 20 贡献值,回答如果被采纳可获得 50 分。
<p>我有一个Python熊猫系列,包含许多行,这些行包含一个单词列表,例如:</p>
<pre><code>25 [estimated, million, people, lived, vulnerable...
176 [cent, vulnerable]
7 [create, sound, policy, frameworks, poor, vuln...
299 [create, sound, policy, frameworks, cent, vuln...
283 [missing, international, levels, based, estima...
...
63 [create, sound, policy, frameworks, world, pop...
259 [build, world, population, still, lived]
193 [create, sound, policy, frameworks, every, sta...
284 [cent, situation, remains, particularly, alarm...
43 [based, less, cent, share, property, inheritan...
Name: clean_text, Length: 300, dtype: object
</code></pre>
<p>如何将所有行的单词连接到一个列表中?我试过:</p>
<pre><code>nameofmyfile.str.cat(sep=', ')
</code></pre>
<p>但我有一个错误:</p>
<blockquote>
<p>TypeError: Cannot use .str.cat with values of inferred dtype 'mixed'.</p>
</blockquote>