我有两张单子。第一个名为location,其长度可以从1到无穷大不等
location = ['loc1,'loc2','loc3','loc4,'loc5','loc6','loc7,'loc8','loc9','loc10,'loc11','loc12','loc13,'loc14','loc15','loc16,'loc17','loc18','loc19,'loc20','loc21','loc22,'loc23','loc24','loc25','loc26','loc27',] <- Please note that length could from 1 to infinite number
第二个列表名为审计员。它的长度通常大于位置列表长度。如果不是第一个或最后一个审计员被分配到其他位置,我想将所有审计员平均分配到各个位置
auditor = ['aone','atwo','athree','afour','afive','asix','aseven','aeight','anine','aten','aeleven','atwelve','athirteen','afourteen','afitheen','asixteen,'aseventeen''] <- Please note that length could from 1 to infinite number
下面的代码在大多数情况下运行良好,但当位置为28,审计员为17时,代码失败
df2['location'] = location
df2['auditor'] = [auditor[int(df2)] for df2 in np.arange(0, len(auditor), (len(auditor)/len(df2)))]
我想要的输出是得到最有可能的甚至分割的列表,并且它必须在任何情况下都能工作,只要位置大于审核员
我的期望输出= “aone”, “aone” “atwo”, “atwo”, “athree”, “athree”, “阿福”, “阿福”, “五”, “五”, "asix",, "asix",, “阿塞文”, “阿塞文”, “好的”, “好的”, “阿宁”, “阿宁”, “阿滕”, “阿滕”, “aeleven”, “aeleven”, “atwelve”, “阿瑟滕”, "昨天",, “阿菲菲菲”, “Asixten”, “Aseventen”]
可以考虑使用在{{CD2>}中发现的^ {CD1>}函数:
祝你好运
相关问题 更多 >
编程相关推荐