from pyecharts import *
from wxpy import *
bot = Bot(cache_path=True)
my_friend = bot.friends().search("ur friend's name", sex=FEMALE, )[0]
@bot.register()
def print_others(msg):
print(msg)
@bot.register(my_friend)
def reply_my_friend(msg):
print('received:{} ({})'.format(msg.text, msg.type))
friends_stats = bot.friends().stats()
print(friends_stats)
attr = []
v1 = []
friends_loc = []
for province, count in friends_stats['sex'].items():
friends_loc.append([province, count])
friends_loc.sort(key=lambda x: x[1], reverse=True)
for p, c in friends_loc[:5]:
attr.append(p)
v1.append(c)
pie = Pie('省份数量统计')
pie.add('', attr, v1, is_label_show=True, center=[50, 60])
pie.render()