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. POJ-3579 Median---二分第k大(二分套二分)

    题目链接: https://cn.vjudge.net/problem/POJ-3579 题目大意: 求的是一列数所有相互之间差值的序列的最中间的值是多少. 解题思路: 可以用二分套二分的方法求解第m ...

  2. 【LOJ6062】「2017 山东一轮集训 Day2」Pair(线段树套路题)

    点此看题面 大致题意: 给出一个长度为\(n\)的数列\(a\)和一个长度为\(m\)的数列\(b\),求\(a\)有多少个长度为\(m\)的子串与\(b\)匹配.数列匹配指存在一种方案使两个数列中的 ...

  3. 【洛谷1494】[国家集训队] 小Z的袜子(莫队)

    点此看题面 大致题意: 有\(N\)只从\(1\sim N\)编号的袜子,告诉你每只袜子的颜色,\(M\)组询问,每组询问给你一个区间\([L\sim R]\),让你求出小Z随机抽出\(2\)只袜子时 ...

  4. React简介

    React JS:可以用react的语法,来编写网页的交互效果 React Native:可以让我们借用react的语法来编写原生的app应用 React VR:在react的基础上去开发VR,或者说 ...

  5. (第五场)G max 【数论】

    题目链接:https://www.nowcoder.com/acm/contest/143/G 题目描述 Give two positive integer c, n. You need to fin ...

  6. 【题解】洛谷P1072 Hankson的趣味题 (gcd和lcm的应用)

    洛谷P1072:https://www.luogu.org/problemnew/show/P1072 思路 gcd(x,a0)=a1 lcm(x,b0)=b1→b0*x=b1*gcd(x,b0) ( ...

  7. C#基础实例

    using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI ...

  8. Java实现双向冒泡排序

    public class BubbleSort_Two { public static void bubbleSort_Two(int[] list){ //j在最外层定义 boolean needN ...

  9. Centos6.9 安装Oracle11gR2

    最近在学习怎么安装Centos,在Centos6.9版本安装Oracle数据库.参考了网络上很多文章,终于可以不报错的完成安装了,在这里记录一下 一.需要用到的安装文件 Centos6.9   ps: ...

  10. ROUND()和TRUNC()函数

    ROUND(number[,decimals]) 其中:number 待做截取处理的数值: decimals 指明需保留小数点后面的位数,可选项.需要注意的是,和trunc函数不同,对截取的数字要四舍 ...