python绘制直方图显示数字_python dataframe中各元素出现次数统计及画直方图

比如:

print(Counter(a[0]))

Counter({'sausage': 825, 'whole milk': 717, 'frankfurter': 580, 'tropical fruit': 482, 'other vegetables': 460, 'citrus fruit': 453, 'pork': 385, 'rolls/buns': 336, 'chicken': 311, 'canned beer': 310, 'beef': 304, 'soda': 294, 'root vegetables': 288, 'pip fruit': 277, 'yogurt': 225, 'ham': 186, 'bottled beer': 178, 'bottled water': 170, 'meat': 170, 'hamburger meat': 167, 'pastry': 132, 'berries': 121, 'curd': 91, 'ice cream': 82, 'coffee': 80, 'beverages': 80, 'whipped/sour cream': 77, 'butter': 76, 'dessert': 71, 'UHT-milk': 70, 'onions': 70, 'grapes': 69, 'brown bread': 57, 'newspapers': 56, 'domestic eggs': 52, 'frozen meals': 51, 'finished products': 50, 'misc. beverages': 49, 'turkey': 49, 'shopping bags': 48, 'chocolate': 46, 'butter milk': 43, 'fruit/vegetable juice': 39, 'salty snack': 39, 'liver loaf': 38, 'cream cheese': 35, 'frozen vegetables': 35, 'specialty chocolate': 32, 'packaged fruit/vegetables': 30, 'waffles': 30, 'herbs': 29, 'oil': 29, 'photo/film': 28, 'white bread': 28, 'chewing gum': 26, 'white wine': 25, 'margarine': 25, 'condensed milk': 24, 'specialty bar': 23, 'pet care': 23, 'cat food': 23, 'sugar': 22, 'fish': 19, 'hard cheese': 19, 'napkins': 19, 'semi-finished bread': 18, 'long life bakery product': 18, 'processed cheese': 16, 'frozen fish': 16, 'hygiene articles': 16, 'detergent': 15, 'liquor': 15, 'sliced cheese': 15, 'nuts/prunes': 15, 'candy': 14, 'spread cheese': 14, 'red/blush wine': 13, 'zwieback': 13, 'pasta': 12, 'potted plants': 11, 'sparkling wine': 11, 'frozen dessert': 11, 'organic sausage': 11, 'dog food': 10, 'baking powder': 10, 'dishes': 10, 'seasonal products': 10, 'curd cheese': 9, 'frozen potato products': 9, 'soft cheese': 9, 'salt': 8, 'specialty cheese': 8, 'canned vegetables': 8, 'sweet spreads': 8, 'mayonnaise': 8, 'dish cleaner': 7, 'cookware': 7, 'brandy': 7, 'chocolate marshmallow': 7, 'instant coffee': 7, 'flower soil/fertilizer': 7, 'flour': 6, 'Instant food products': 6, 'liquor (appetizer)': 5, 'cling film/bags': 5, 'house keeping products': 5, 'soups': 5, 'roll products': 5, 'cereals': 5, 'male cosmetics': 5, 'candles': 5, 'cooking chocolate': 5, 'popcorn': 4, 'cleaner': 4, 'pickled vegetables': 4, 'potato products': 4, 'light bulbs': 4, 'sauces': 4, 'liqueur': 4, 'female sanitary products': 3, 'soap': 3, 'frozen chicken': 3, 'artif. sweetener': 3, 'canned fish': 3, 'bathroom cleaner': 3, 'frozen fruits': 3, 'mustard': 3, 'tidbits': 3, 'decalcifier': 2, 'vinegar': 2, 'prosecco': 2, 'canned fruit': 2, 'rum': 2, 'bags': 2, 'whisky': 2, 'abrasive cleaner': 2, 'syrup': 2, 'cream': 2, 'softener': 2, 'jam': 2, 'hair spray': 1, 'baby cosmetics': 1, 'spices': 1, 'specialty fat': 1, 'snack products': 1, 'dental care': 1, 'kitchen towels': 1, 'meat spreads': 1, 'ketchup': 1, 'skin care': 1, 'rubbing alcohol': 1, 'nut snack': 1, 'cocoa drinks': 1, 'organic products': 1, 'cake bar': 1, 'honey': 1, 'kitchen utensil': 1, 'flower (seeds)': 1})

print(Counter(a[0:31]))

Counter({0: 1, 1: 1, 2: 1, 3: 1, 4: 1, 5: 1, 6: 1, 7: 1, 8: 1, 9: 1, 10: 1, 11: 1, 12: 1, 13: 1, 14: 1, 15: 1, 16: 1, 17: 1, 18: 1, 19: 1, 20: 1, 21: 1, 22: 1, 23: 1, 24: 1, 25: 1, 26: 1, 27: 1, 28: 1, 29: 1, 30: 1, 31: 1})

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
提供的源码资源涵盖了安卓应用、小程序、Python应用和Java应用等多个领域,每个领域都包含了丰富的实例和项目。这些源码都是基于各自平台的最新技术和标准编写,确保了在对应环境下能够无缝运行。同时,源码配备了详细的注释和文档,帮助用户快速理解代码结构和实现逻辑。 适用人群: 这些源码资源特别适合大学生群体。无论你是计算机相关专业的学生,还是对其他领域编程感兴趣的学生,这些资源都能为你提供宝贵的学习和实践机会。通过学习和运行这些源码,你可以掌握各平台开发的基础知识,提升编程能力和项目实战经验。 使用场景及目标: 在学习阶段,你可以利用这些源码资源进行课程实践、课外项目或毕业设计。通过分析和运行源码,你将深入了解各平台开发的技术细节和最佳实践,逐步培养起自己的项目开发和问题解决能力。此外,在求职或创业过程,具备跨平台开发能力的大学生将更具竞争力。 其他说明: 为了确保源码资源的可运行性和易用性,特别注意了以下几点:首先,每份源码都提供了详细的运行环境和依赖说明,确保用户能够轻松搭建起开发环境;其次,源码的注释和文档都非常完善,方便用户快速上手和理解代码;最后,我会定期更新这些源码资源,以适应各平台技术的最新发展和市场需求。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值