可用率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 ...
随机推荐
- mobile easyui兼容实体数据(tree插件为例)
ORM的实体类和数据库的类是一一对应的,如果有多级的嵌套循环json返回到前台为了方便展示可以使用mobile easyui,但是mobile easyui又需要特定的属性才可以,比如id,text, ...
- Codeforces Round #460 (Div. 2)
A. Supermarket We often go to supermarkets to buy some fruits or vegetables, and on the tag there pr ...
- Codeforces Round #432 (Div. 2)
A. Arpa and a research in Mexican wave Arpa is researching the Mexican wave. There are n spectators ...
- 深度优先搜索(dfs),城堡问题
题目链接:http://poj.org/problem?id=1164 1.深搜,每个点都访问一次,没有标记的话,就做深搜,同时标记. #include <iostream> #inclu ...
- 2018.9.16 Redis 边学习边总结
Redis 是一个使用 C 语言写成的,开源的 key-value 数据库..和Memcached类似,它支持存储的value类型相对更多,包括string(字符串).list(链表).set(集合) ...
- 0.Python 爬虫之Scrapy入门实践指南(Scrapy基础知识)
目录 0.0.Scrapy基础 0.1.Scrapy 框架图 0.2.Scrapy主要包括了以下组件: 0.3.Scrapy简单示例如下: 0.4.Scrapy运行流程如下: 0.5.还有什么? 0. ...
- mybatis学习记录六——一对一、一对多和多对多查询
9 订单商品数据模型 9.1 数据模型分析思路 1.每张表记录的数据内容 分模块对每张表记录的内容进行熟悉,相当 于你学习系统 需求(功能)的过程. 2.每张表重要的字段设置 非空 ...
- Git免密码提交
下面说一下https克隆的方式免密码提交 在我们下载链接前面加上账号:密码@即可 方式一: 使用https的方式克隆代码 git clone '地址' 查看项目中的配置文件 vim .git/conf ...
- ROS indigo安装完成后运行小乌龟示例程序
安装ROS成功后,在Beginner Tutorials中有一个简单的示例程序. 在Terminal中运行以下命令:$ roscore新开一个terminal,运行以下命令,打开小乌龟窗口:$ ros ...
- 解密Spring加载的Properties文件
Spring的框架中,org.springframework.beans.factory.config.PropertyPlaceholderConfigurer类可以将.properties(key ...