python数据分析:赶集网二手物品市场各类目发帖量

统计赶集网二手市场各类目发帖量

效果是这样的:

python数据分析:赶集网二手物品市场各类目发帖量_第1张图片
图标展示

我的代码:

from pymongo import MongoClient
import charts
client=MongoClient('localhost',27017)
ganjiDB=client['ganjiDB']
detail_info=ganjiDB['detail_info']
cates_list=[]
for i in detail_info.find():
    cates_list.append(i['cates'][2])
cates_index=list(set(cates_list))
#print(cates_index,len(cates_index))
post_times=[]
for index in cates_index:
    post_times.append(cates_list.count(index))
#print(post_times)
def get_gen(types):
    length=0
    if length<=len(cates_index):
        for index,times in zip(cates_index,post_times):
            info={
                'name':index,
                'data':[times],
                'type':types
            }
            yield info
            length+=1
series=[data for data in get_gen('column')]
charts.plot(series, show='inline', options=dict(title=dict(text='二手物品市场各类目发帖量')))

你可能感兴趣的:(python数据分析:赶集网二手物品市场各类目发帖量)