<p>我有一个数据集,如下所示:</p>
<p>ds=['North'、'Raw'、'Tree']、['Saw'、'Raw'、'Apple']、['Saw'、'Apple']、['Gum'、'Saw']、…]</p>
<p>数据集有21145个值。我已经在Jupyter中导入了这个数据集,并尝试运行下面的代码,将这个列表作为一个列表</p>
<p>代码:</p>
<pre><code> list_1 = []
for sublist in ds:
for val in sublist:
list_1.append(val)
</code></pre>
<p>我得到的错误是:</p>
<pre><code> 1 list_1 = []
2 for sublist in ds:
3 for val in sublist: <---
4 list_1.append(val)
</code></pre>
<p>TypeError:“float”对象不可编辑</p>
<p>预期产出为:</p>
<p>列表_1=['North','Raw','Tree','Saw','Raw','Apple','Saw','Apple','Gum','Saw',…]</p>