我正在尝试创建一个包含 18330 行的数据框字典。但字典停在第 15275 行。我无法理解相同的根本原因。'''final_dict = dict()item = df1['Item Code']id = df1['store ID']sp = df1['Selling Price']mrp = df1['MRP']for a in range(0, item.__len__()): key = str(item[a]) + "|" + str(id[a]) value = str(sp[a]) + "|" + str(mrp[a]) final_dict[key] = value key_list = final_dict.keys()print(item.__len__())print(len(final_dict))print(len(key_list))print(len(df1.index))df1['key'] = key_listprint(df1)'''Output: 18330152751527518330error : "ValueError: Length of values does not match length of index"数据框示例:谁能帮我理解我的错误。
添加回答
举报
0/150
提交
取消