我正试图根据一个条件将字符串连接成两行。我使用for循环来合并值。你知道吗
图像中给出了输入数据集和输出列
我使用for循环来连接行中的值
for i in range(len(Data)):
j=i+1
while j < len(Data):
if(Data['key (Sum(col1to6))'][i]!=Data['key (Sum(col1to6))'][j]):
break;
if (Data['key (Sum(col1to6))'][i]==Data['key (Sum(col1to6))'][j]) and Data['value'][i]<10:
Data['ouput_code'][i]=Data['Col6'][i]+Data['Col6'][j]
else:
Data['ouput_code']=Data['Col6']
j=j+1
print ('last',i)
在我的最终输出中,所有行都被合并。你知道吗
虽然我想让你知道,我还没有完全理解你的问题,但看看代码,我看到下面的错误,这可能是造成你的问题。你知道吗
这就是你想做的吗?你知道吗
谢谢
相关问题 更多 >
编程相关推荐