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

作者: 69b4d66ae7a1 | 来源:发表于2017-01-07 22:20 被阅读0次

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

    效果是这样的:

    图标展示

    我的代码:

    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数据分析:赶集网二手物品市场各类目发帖量

        本文链接:https://www.haomeiwen.com/subject/ahzfbttx.html