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. Android(java)学习笔记57:PC and Phone 通信程序

    1. 首先我写的程序代码如下: package com.himi.udpsend; import java.net.DatagramPacket; import java.net.DatagramSo ...

  2. csu 1965

    Description You are a boss who has N employers. One day, you have a message and you want to tell it ...

  3. 将 form 参数转换为 json 绑定 datagrid 上

    $.fn.serializeJson=function(){ var serializeObj={}; var array=this.serializeArray(); var str=this.se ...

  4. Blog 使用Jsoup解析出html中的img元素

    Jsoup主页:http://jsoup.org/ 在Blog.java 加入 private List<String> imageList=new LinkedList<Strin ...

  5. 卸载由源码编译安装的软件(如OpenCV)

    看安装软件的时候有没有使用--prefix这个参数,如果有那就把你指定的文件给删除了就行了. 如果没有用这个参数就麻烦一点了,那就进入到软件解压后的目录,执行sudo make uninstall看能 ...

  6. Promise面试题

    题目一 const promise = new Promise((resolve, reject) => { console.log(1); resolve(); console.log(2); ...

  7. HTML中id和class选择器

    <1>.id和class的区别? id相当于人的身份证不可以重复 class相当于人的名称可以重复 一个HTML标签只能绑定一个id名称 一个HTML标签可以绑定多个class名称 < ...

  8. 多线程编程-设计模式之保护性暂挂(Guarded Suspesion)模式

    Guarded Suspension模式的架构 核心是一个受保护方法(Guarded Method).该方法需要执行其所要真正执行的操作时需要满足特定的条件(Predicate,以下称之为保护条件). ...

  9. 带你解析Java类加载机制

      目录 Java类加载机制的七个阶段 加载 验证 准备(重点) 解析 初始化(重点) 使用 卸载 实战分析 方法论 树义有话说 在许多Java面试中,我们经常会看到关于Java类加载机制的考察,例如 ...

  10. POJ 2007--Scrambled Polygon(计算凸包,点集顺序)

    Scrambled Polygon Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 10094   Accepted: 476 ...