example
import pandas as pd
import numpy as np
import os,sys df = pd.read_excel("C:\\Users\\ryanzhang\\Desktop\\template.xlsx")
a = df.columns
b = pd.DataFrame(a,a)
c = b.T
d = c.append(df) def highlight_max(s):
if s.name == :
#print(['background-color: yellow' if v else '' for v in is_max])
return ['background-color: yellow']*len(s)
else:
return ['']*len(s) one = df.style.set_properties(**{'border-style': 'solid','border-width':'1px','text-align':'left'})
two = one.apply(highlight_max,axis=)
two.to_excel("C:\\Users\\ryanzhang\\Desktop\\test.xlsx",header=False, index=False,)
import pandas as pd
a = [["ryan","job","can"],["good","you","me"],["ryan","hello","how"],["any","each","where"]]
name = ["one","two","three"]
index = ["four","five","six","seven"]
b = pd.DataFrame(a,index=index,columns=name)
print(b,"\n")
def need_group(index):
if b.loc[index]["one"] =="ryan":
return 1
elif b.loc[index]["one"] =="good":
return 1
elif b.loc[index]["one"] =="any":
return 3 c = b.groupby(need_group)
for i,j in c:
print(i,"\n",j)
随机推荐
- vant - Navbar slot 插槽使用
//子组件 <template> <van-nav-bar> <slot slot="left" name="left">& ...
- GoCN每日新闻(2019-10-22)
GoCN每日新闻(2019-10-22) GoCN每日新闻(2019-10-22) 1. Go 集成测试:https://www.ardanlabs.com/blog/2019/10/integrat ...
- vue引入nutUI
这段时间需要做一个移动端项目,我需要选着用哪个UI库,其它的UI库没多看,看了看mintUI和nutUI,感觉mintUI的功能要比nutUI的功能少点,mintUI是饿了么团队开发的,而nutUI是 ...
- P2052 [NOI2011]道路修建——树形结构(水题,大佬勿进)
P2052 [NOI2011]道路修建 这个题其实在dfs里面就可以把事干完的,(我一开始还拿出来求了一把)…… 一条边的贡献就是儿子的大小和n-siz[v]乘上边权: #include<cma ...
- 缺陷的优先程度(Priority)
测试人员希望程序员什么时间哪个版本修改该bug (1)Urgent 立即修改否则影响开发进度 (2)Veryhigh 本版本修改 (3)High 下个版本修改 (4)Medium 发布前修改 (5)L ...
- SpringBoot异步及线程池配置
异步方法注解@Async 在SpringBoot中进行异步处理,可以使用异步注解@Async和@EnableAsync. @Async注解表示异步,如:@Async("asyncServic ...
- Unity内存优化之视频讲解
视频为中文讲解,mp4格式,大小3.05GB 目录 扫码时备注或说明中留下邮箱 付款后如未回复请至https://shop135452397.taobao.com/ 联系店主
- Deep-learning augmented RNA-seq analysis of transcript splicing | 用深度学习预测可变剪切
可变剪切的预测已经很流行了,目前主要有两个流派: 用DNA序列以及variant来预测可变剪切:GeneSplicer.MaxEntScan.dbscSNV.S-CAP.MMSplice.clinVa ...
- Hbuilder提交项目到GitHub出现cannot open git-upload-pack
问题描述 Hbuilder上传本地项目到GitHub时是通过下载的Egit插件,然而提交代码时出现下图问题 网上有说添加http的sslVerify=false,然并卵. 解决方案 不用hbuilde ...
- LoadRunner之录制你的第一个脚本
LoadRunner安装完成之后,肯定就迫不及待的想要上手试用了.下面就是讲一下LR脚本录制的流程和基本的设置. 1.先放一张脚本录制以及运行的流程图 2.脚本录制步骤 1)以管理员身份打开LR软件, ...