【发布时间】:2018-01-05 14:14:15
【问题描述】:
我有一个列表格式为:
testing_set = ["001,P01", "002,P01,P02", "003,P01,P02,P09", "004,P01,P03"]
我使用re 重新格式化列表:
[in] test_set1 = [ re.split(r',', line, maxsplit=5) for line in testing_set]
[out] ["001","P01"]
如何创建索引为 (transaction_id) "001,002,003,004" 的数据框,并且每行的 p 值都列在 (product_id) 列中。
【问题讨论】:
-
您的列表列表...您的意思是字符串列表吗?
-
它是一个字符串列表的列表
-
请阅读how to make good reproducible pandas examples并相应地编辑您的帖子。