标签:yellow use max app xls border xlsx == span
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 == 0: #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=1) two.to_excel("C:\\Users\\ryanzhang\\Desktop\\test.xlsx",header=False, index=False,)
标签:yellow use max app xls border xlsx == span
原文地址:https://www.cnblogs.com/windyrainy/p/10999377.html