total_data =[
{'event_current_dealer': '陈铁', 'id__count': 66},
{'event_current_dealer': '丁凯', 'id__count': 70},
{'event_current_dealer': '丁志杰', 'id__count': 76}, #相当于item
{'event_current_dealer': '郭雁平', 'id__count': 58},
{'event_current_dealer': '王宇', 'id__count': 1},
{'event_current_dealer': '周敬尧', 'id__count': 8},
{'event_current_dealer': '刘晓明', 'id__count': 80},
{'event_current_dealer': '孙奥开', 'id__count': 47},
{'event_current_dealer': '李大鹏', 'id__count': 3},
{'event_current_dealer': '戚文龙', 'id__count': 42},
{'event_current_dealer': 'nan', 'id__count': 4},
{'event_current_dealer': '陈思文', 'id__count': 86},
{'event_current_dealer': '王聪渊', 'id__count': 15},
{'event_current_dealer': '屈蕾', 'id__count': 1}
] hang_data =[
{'event_hang_person': '陈铁', 'id__count': 2},
{'event_hang_person': '丁凯', 'id__count': 1},
{'event_hang_person': '丁志杰', 'id__count': 3},
{'event_hang_person': '郭雁平', 'id__count': 3},
{'event_hang_person': '王宇', 'id__count': 1},
{'event_hang_person': '周敬尧', 'id__count': 2},
{'event_hang_person': '刘晓明', 'id__count': 2},
{'event_hang_person': '王珠珠', 'id__count': 1},
{'event_hang_person': '李大鹏', 'id__count': 2} ] t =[]
t_v =[]
for item in total_data:
t.append(item['event_current_dealer'])
t_v.append(item['id__count']) if "nan" in t:
t.remove("nan") h = []
h_v = []
for item in hang_data:
h.append(item['event_hang_person'])
h_v.append(item['id__count'])
if "nan" in h:
h.remove("nan") # 挂起人是自己的
h_p = set(t).intersection(set(h))
"""
{'李大鹏', '陈铁', '郭雁平', '丁凯', '王宇', '丁志杰', '刘晓明', '周敬尧'}
""" """
有挂起率的人员
将数据封装成以下样式:
{"李大鹏":10,}
"""
# print(h_p) t_dict = dict(zip(t,t_v))
h_dict = dict(zip(h,h_v)) t_new_dict = dict() for item in h_p:
for k,v in t_dict.items():
if item == k:
t_new_dict[item]=v h_new_dict =dict()
for item in h_p:
for k,v in h_dict.items():
if item == k:
h_new_dict[item]=v # print(t_new_dict)
# print(h_new_dict) # 按名字排序
t_names =[]
for item in t_new_dict:
t_names.append(item) t_names.sort(reverse=True) t_last = dict()
for item in t_names:
for k,v in t_new_dict.items():
if item == k :
t_last[item] =v h_last = dict()
for item in t_names:
for k,v in h_new_dict.items():
if item == k :
h_last[item] =v print(t_last)
print(h_last) t_last_v =[] for k,v in t_last.items():
t_last_v.append(v) h_last_v =[]
for k,v in h_last.items():
h_last_v.append(v) print(t_last_v)
print(h_last_v) findal_result = map(lambda x,y:str(round(x/y,2)*100)+"%",h_last_v,t_last_v) print(list(findal_result)) "conet".strip()

asyncio

可用率map处理的更多相关文章

  1. 清除list或者map集合,减少内存的占用率

    1.在编写程序对数据处理的时候我们经常会使用到list和map集合,有些时候我们存到集合里的数据只是暂时性的,在验证完或者使用完之后尽量对list或者map清空,及list.clear()后者map. ...

  2. linux ps命令,查看进程cpu和内存占用率排序(转)

    使用以下命令查看: ps -aux | sort -k4,4n ps auxw --sort=rss ps auxw --sort=%cpu linux 下的ps命令 %CPU 进程的cpu占用率 % ...

  3. Javascript 如何生成Less和Js的Source map

    为什么有Source map CSS和JS脚本正变得越来越复杂,为了解决网络瓶颈,大部分源代码都需要经过编译.合并.压缩才能运用到实际环境中.为了减少网络资源占用,源码一般都会经过以下方式处理: 使用 ...

  4. jmap(Memory Map For Java)

    功能   jmap(Memory Map For Java)命令用于生成堆转储快照(一般称为heaphump或dump文件).如果不使用jmap命令,要想获取Java堆转储快照还有一些比较“暴力”的手 ...

  5. map和unordered_map的差别和使用

    map和unordered_map的差别还不知道或者搞不清unordered_map和map是什么的,请见:http://blog.csdn.net/billcyj/article/details/7 ...

  6. Linux CPU占用率监控工具小结

    关键词:top.perf.sar.ksar.mpstat.uptime.vmstat.pidstat.time.cpustat.munin.htop.glances.atop.nmon.pcp-gui ...

  7. zprofiler三板斧解决cpu占用率过高问题(转载)

    zprofiler三板斧解决cpu占用率过高问题 九居 JVM性能与调试平台   zprofiler   上周五碰到了一个线上机器cpu占用率过高的问题.问题本身比较简单,但是定位过程中动用了多个zp ...

  8. 【转】Map 与 Unordered_map

    map和unordered_map的差别和使用 map和unordered_map的差别还不知道或者搞不清unordered_map和map是什么的,请见:http://blog.csdn.net/b ...

  9. zprofiler三板斧解决cpu占用率过高问题

    zprofiler三板斧解决cpu占用率过高问题  九居 浏览 171 2015-04-08 14:11:58 发表于:JVM性能与调试平台   zprofiler   上周五碰到了一个线上机器cpu ...

随机推荐

  1. Ubuntu 12.04 安装Chrome步骤

    一.添加PPA 从Google Linux Repository(http://www.google.com/linuxrepositories/)下载安装Key,或把下面的代码复制进终端,回车,需要 ...

  2. codeforces 611D New Year and Ancient Prophecy

    f[i = 以i结尾][j = 长度为j] = 方案数. f[i][j] = sum{ f[i-j][k] , k < j || (k == j && s(i-j+1,j) &g ...

  3. BZOJ 2038: [2009国家集训队]小Z的袜子(hose) 【莫队算法模版】

    任意门:https://www.lydsy.com/JudgeOnline/problem.php?id=2038 题意概括: 有 N 只袜子(分别编号为1~N),有 M 次查询 (L, R)里面随机 ...

  4. CodeForces - 598A Tricky Sum (数学,快速幂的运用)

    传送门: http://codeforces.com/problemset/problem/598/A A. Tricky Sum time limit per test 1 second memor ...

  5. 我的wmware

    1.vmware 网络连接方式 NAT 模式: 虚拟机的IP 是由NAT分配的,电脑环境无论如何变化,都不会影响虚拟机 好处:在家.学校.公司,连接虚拟机都可以使用相同的ip地址 桥接模式: 只要更换 ...

  6. linux 使用sqlite3

    :c中使用sqlite3需要调用函数接口操作: sqlite3 *db; int status=sqlite_open("dbname",&db);//打开或者创建数据库 ...

  7. mysql存储过程和函数(一)

    存储过程和函数是事先经过编译并存储在数据库的一段sql语句集合,调用存储过程和函数可以简化应用程序开发人员的很多工作,减少数据在数据库和应用服务器之间的传输,对提高数据运行效率是有好处的. 存储过程和 ...

  8. 关于 'list' object has no attribute 'select'

    我是在写爬虫是遇到了这个问题: c = chapter.select('href')AttributeError: 'list' object has no attribute 'select' 这是 ...

  9. 简单使用PuTTy登录centos虚拟机

    博主刚刚开始学习Linux,想通过写博客的方式加深对linux学习的记忆 使用虚拟机安装精简版的linux后发现窗口字体太小,于是就想着通过PuTTy登录的方式解决 简单安装linux后 将linux ...

  10. [异常笔记]poi读取Excel异常

    Exception in thread "main" org.apache.poi.poifs.filesystem.OfficeXmlFileException: The sup ...