【发布时间】:2023-01-20 00:10:29
【问题描述】:
我目前正在尝试将数据框导出为 png 文件。直到几天前,我才能够使用 dataframe_image 模块,使用 dfi.export() 函数成功地做到这一点。现在它返回错误:SyntaxError: not a PNG file
这是我目前使用的功能。我怎样才能解决这个问题?
def imprimir_fig():
fig = pd.DataFrame(out)
pd.set_option('display.colheader_justify', 'center')
fig.columns=['Tipo','Valorizada']
fig= fig.style.hide_index()
fig= fig.set_properties(**{'text-align': 'center'})
fig= fig.set_table_styles([dict(selector = 'th', props=[('text-align', 'center')])])
dfi.export(fig, f'{dirG}\\moneda {comitente}.png')
return(fig)
imprimir_fig()
我尝试使用 dfi 的其他功能,但它似乎不再起作用,有没有人遇到过类似的问题?
【问题讨论】: