Python 将dataframe保存到png中导致当前字体丢失错误
我目前正在尝试将数据帧保存在png文件中。不幸的是,出现了一个错误:Python 将dataframe保存到png中导致当前字体丢失错误,python,pandas,matplotlib,Python,Pandas,Matplotlib,我目前正在尝试将数据帧保存在png文件中。不幸的是,出现了一个错误: C:\Users\user\venv\recommender-model\lib\site-packages\matplotlib\backends\backend_agg.py:201: RuntimeWarning: Glyph 25215 missing from current font. font.set_text(s, 0, flags=flags) 这是我的代码: pd.set_option('di
C:\Users\user\venv\recommender-model\lib\site-packages\matplotlib\backends\backend_agg.py:201: RuntimeWarning: Glyph 25215 missing from current font.
font.set_text(s, 0, flags=flags)
这是我的代码:
pd.set_option('display.max_columns', 15)
save_to_png(traindata.head(3), "data")
import matplotlib.pyplot as plt
from pandas.plotting import table
def save_to_png(dataframe, name):
df = dataframe
fig = plt.figure()
ax = plt.subplot(111)
ax.axis('off')
table(ax, df, bbox=[0, 0, 1, 1])
plt.savefig(name + '.png')
df = traindata.head(3)
print(df)
数据集是最新的。
看起来像
如何将此数据帧保存到png中