'''
author:
date:20200303
func:统计微信好友性别,并可视化
'''
from pyecharts.charts import Pie
import csv
from pyecharts import options as opts
#1.读取.csv文件,把性别信息读取出来
def getSex(filename):
# 存储性别的列表
lstsex=[]
# 打开文件,设定模式为只读
with open(filename,'r') as fr:
reader=csv.reader(fr)
# 遍历,把24列数据添加到列表中
for i in reader:
lstsex.append(i[24])
return lstsex
# 2.性别pyechart可视化
def VisualSexpyechart(lstsex):
sex=dict()
# 2.1提取好友性别信息,从1开始,因为0是自己
for f in lstsex[1:]:
if f=='1':
# 男
统计微信好友性别,并可视化
最新推荐文章于 2024-05-13 03:23:30 发布