问题 I'm trying to export a stylish data frame to an exel file using the scrpit bellow import pandas as pd import numpy as np np.random.seed(24) df = pd.DataFrame({'A': np.linspace(1, 10, 10)}) df = pd.concat([df, pd.DataFrame(np.random.randn(10, 4), columns=list('BCDE'))],axis=1) df.iloc[0, 2] = np.nan def highlight_greater(x): r = 'red' g = 'gray' m1 = x['B'] > x['C'] m2 = x['D'] > x['E'] df1 = pd.DataFrame('background-color: ', index=x.index, columns=x.columns) #rewrite values by boolean masks