**之后的MetaSerialisable对象参数必须是映射,而不是unicode

时间:2017-11-25 20:42:26

标签: python xlsxwriter

尝试将此样式器对象转换为xlsx表:

 avg.style.background_gradient(cmap='RdYlGn',low=.09,high=.18,axis=1).to_excel('test.xlsx',engine='xlsxwriter')

enter image description here

然而,我收到错误:

 TypeError: MetaSerialisable object argument after ** must be a mapping, not unicode

当我尝试时:

 avg.style.background_gradient({'cmap':'RdYlGn'},low=.09,high=.18,axis=1).to_excel('test.xlsx',engine='xlsxwriter')

TypeError: ("unhashable type: 'dict'", u'occurred at index (Gain/Expsr%, 5)')

这里有一个,没有背景渐变输出:

writer = pd.ExcelWriter('usher.xlsx')
df.style.background_gradient(cmap='RdYlGn').to_excel(writer,engine='openpyxl')
writer.save()

0 个答案:

没有答案