看过实例后做起来比较容易
我的成果
Paste_Image.png我的代码
cates_list=[]
for i in item_infos.find():
cates_list.append(i['cates'][2])
cates_index=list(set(cates_list))
print(cates_index)
cate_times=[]
for index in cates_index:
cate_times.append(cates_list.count(index))
print(cate_times)
def cate_posts(types):
length=0
if length <= len(cates_index):
for cate,times in zip(cates_index,cate_times):
data={
'name':cate,
'data':[times],
'type':types
}
yield data
length+=1
series=[data for data in cate_posts('column')]
charts.plot(series,show='inline',options=dict(title=dict(text='北京各类目二手物品发帖量')))
总结
- 简单统计一下各个类目的发帖量
网友评论