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})

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值