数据处理 preprocess.py
data OrderedDict
([('session_id', '1638'), ('user_id', 'NA'), ('item_id', '34157'), ('timeframe', '113380'), ('eventdate', '2016-04-25')])
sess_clicks {'1': [('81766', 526309), ('31331', 1031018), ('32118', 243569), ('9654', 75848), ('32627', 1112408)]}
a={1:'a',5:'d'}
print(a)
print(a.items())
print(list(a))
>>>
{1: 'a', 5: 'd'}
dict_items([(1, 'a'), (5, 'd')])
[1, 5]
data长这样,就是那两个东西合起来
287], [272, 287, 287], [272, 287], [272]], [3, 2, 5, 7, 9, 9, 11, 11, 11, 13, 14, 18, 17, 16, 19, 20, 21, 23, 23
tr_seqs
[[1, 2], [1], [4], [6], [8, 9], [8], [10, 11, 11], [10, 11], [10], [12], [14], [15, 16, 17], [272, 287, 287, 287, 271], [272, 287, 287, 287], [272, 287, 287], [272, 287], [272]]
tr_labs
[3, 2, 5, 7, 9, 9, 11271, 287, 287, 287]
上边两个,生成下边两个
csv.DictReader
https://blog.csdn.net/tomatomas/article/details/81005503
sorted
https://www.runoob.com/python/python-func-sorted.html
Python3 zip() 函数
https://www.runoob.com/python3/python3-func-zip.html