[('HOMICIDE', [('2017', 1)]),
('DECEPTIVE PRACTICE', [('2017', 14), ('2016', 14), ('2015', 10), ('2013', 4), ('2014', 3)]),
('ROBBERY', [('2017', 1)])]
如何,當我試圖使用映射其作爲「AttributeError的投擲轉換爲
[('HOMICIDE', ('2017', 1)),
('DECEPTIVE PRACTICE', ('2015', 10)),
('DECEPTIVE PRACTICE', ('2014', 3)),
('DECEPTIVE PRACTICE', ('2017', 14)),
('DECEPTIVE PRACTICE', ('2016', 14))]
:‘名單’對象沒有屬性'map'「
rdd = sc.parallelize([('HOMICIDE', [('2017', 1)]), ('DECEPTIVE PRACTICE', [('2017', 14), ('2016', 14), ('2015', 10), ('2013', 4), ('2014', 3)])])
y = rdd.map(lambda x : (x[0],tuple(x[1])))
得到它的工作...感謝您的信息... –