我正在尝试创建一个键:值对字典,其中键是数据帧的列名,值是包含该列中所有唯一值的列表。最终,我希望能够根据条件从dict中筛选出键-值对。这就是我目前所能做的:
for col in col_list[1:]:
_list = []
_list.append(footwear_data[col].unique())
list_name = ''.join([str(col),'_list'])
product_list = ['shoe','footwear']
color_list = []
size_list = []
这里的产品、颜色、大小都是列名,dict键应该相应地命名,如color_list等。 最终,我需要访问字典中的每个键:value_列表。 预期产量:
KEY VALUE
color_list : ["red","blue","black"]
size_list: ["9","XL","32","10 inches"]
目前没有回答
相关问题 更多 >
编程相关推荐