可用率map处理
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处理的更多相关文章
- 清除list或者map集合,减少内存的占用率
1.在编写程序对数据处理的时候我们经常会使用到list和map集合,有些时候我们存到集合里的数据只是暂时性的,在验证完或者使用完之后尽量对list或者map清空,及list.clear()后者map. ...
- linux ps命令,查看进程cpu和内存占用率排序(转)
使用以下命令查看: ps -aux | sort -k4,4n ps auxw --sort=rss ps auxw --sort=%cpu linux 下的ps命令 %CPU 进程的cpu占用率 % ...
- Javascript 如何生成Less和Js的Source map
为什么有Source map CSS和JS脚本正变得越来越复杂,为了解决网络瓶颈,大部分源代码都需要经过编译.合并.压缩才能运用到实际环境中.为了减少网络资源占用,源码一般都会经过以下方式处理: 使用 ...
- jmap(Memory Map For Java)
功能 jmap(Memory Map For Java)命令用于生成堆转储快照(一般称为heaphump或dump文件).如果不使用jmap命令,要想获取Java堆转储快照还有一些比较“暴力”的手 ...
- map和unordered_map的差别和使用
map和unordered_map的差别还不知道或者搞不清unordered_map和map是什么的,请见:http://blog.csdn.net/billcyj/article/details/7 ...
- Linux CPU占用率监控工具小结
关键词:top.perf.sar.ksar.mpstat.uptime.vmstat.pidstat.time.cpustat.munin.htop.glances.atop.nmon.pcp-gui ...
- zprofiler三板斧解决cpu占用率过高问题(转载)
zprofiler三板斧解决cpu占用率过高问题 九居 JVM性能与调试平台 zprofiler 上周五碰到了一个线上机器cpu占用率过高的问题.问题本身比较简单,但是定位过程中动用了多个zp ...
- 【转】Map 与 Unordered_map
map和unordered_map的差别和使用 map和unordered_map的差别还不知道或者搞不清unordered_map和map是什么的,请见:http://blog.csdn.net/b ...
- zprofiler三板斧解决cpu占用率过高问题
zprofiler三板斧解决cpu占用率过高问题 九居 浏览 171 2015-04-08 14:11:58 发表于:JVM性能与调试平台 zprofiler 上周五碰到了一个线上机器cpu ...
随机推荐
- 【转载】#438 - Benefits of Using Interfaces
You might wonder why you'd define an interface, have a class implement that interface and then acces ...
- UVA - 11488 前缀
题目链接:https://vjudge.net/contest/166647#problem/A 题意: 从一些字符串集合里面挑一子集,然后公共前缀长度*字符串个数最大: 分析: 将这些字符串放到一个 ...
- 【[AHOI2012]树屋阶梯】
卡特兰数! 至于为什么是卡特兰数,就稍微说那么一两句吧 对于一个高度为\(i\)的阶梯,我们可以在左上角填一个高度为\(k\)的阶梯,右下角填一个高度为\(i-1-k\)的阶梯剩下的我们用一个大的长方 ...
- pytorch 反向梯度计算问题
计算如下\begin{array}{l}{x_{1}=w_{1} * \text { input }} \\ {x_{2}=w_{2} * x_{1}} \\ {x_{3}=w_{3} * x_{2} ...
- 解决 Database Configuration Assistannt安装oracle实例使的 警告
在创建到85%的时候报错,错误如下: 解决办法: 经过查看警告中给出的日志文件F:\develop\oracle_data\app\Administrator\cfgtoollogs\dbca\tes ...
- js时间日期格式
Date.prototype.format = function(format){ var o = { "M+" : this.getMonth()+1, //month &quo ...
- bootstrapPaginator设置同步会翻2页的小坑
因为需要用到post的返回值在做后面的决定.不想嵌套在回调函数中.网上找了一下.设置为同步 $.ajaxSetup( { async: false }); 结果bootstrap的翻页组件就出了bug ...
- vue2.0移除或更改的一些东西
一.vue2.0移除了$index和$key 虽然说现在很多文章说他们的代码是vue2.0版本的,但是有一些仔细一看,发现并不全是2.0版本,有些语法还是1.0的版本,比如这个$index,$key, ...
- 配置隐私协议 - iOS
根据苹果隐私协议新规的推出,要求所有应用包含隐私保护协议,故为此在 App 中添加了如下隐私协议模块. 首次安装 App 的情况下默认调用隐私协议模块展示相关信息一次,当用户点击同意按钮后,从此不再执 ...
- Python学习——01Linux基础之常用基本命令
做Linux要知道两件事: 首先知道自己处在什么位置(桌面……) 区分大小写 pwd:查看当前所在目录 “/”代表:根目录 Cd: cd( ...