我附加了一些我的数据列,如:
0 0 0 1 0 1 0 1 1 0 0 2 0 0 0 1 0 3 0 0 0 0 0 4 0 0 1 0 0
我想让它看起来像:
[0,0,1,0,0] [0,0,0,1,0]
但是当我:
for i in range(len(re)):
concat=[]
for o in range(5):
concat.append(re.iloc[i,o])
re.iloc[i,-1]=concat
Traceback (most recent call last): File "", line 5, in re.iloc[i,-1]=concat File "D:\anaconda\lib\site-packages\pandas\core\indexing.py", line 179, in __setitem__ self._setitem_with_indexer(indexer, value) File "D:\anaconda\lib\site-packages\pandas\core\indexing.py", line 579, in _setitem_with_indexer raise ValueError('Must have equal len keys and value ' ValueError: Must have equal len keys and value when setting with an iterable
如何组合这些列? 我是一个新学习者。我的英语不太好,以至于我没有仔细查看这类案例的所有答案。谢谢。