How to save the Pandas dataframe/series data as a figure?

前端 未结 7 1792
猫巷女王i
猫巷女王i 2020-11-29 00:25

It sounds somewhat weird, but I need to save the Pandas console output string to png pics. For example:

>>> df
                   sales  net_pft             


        
7条回答
  •  渐次进展
    2020-11-29 01:09

    You have to use the figure returned by the DataFrame.plot() command:

    ax = df.plot()
    fig = ax.get_figure()
    fig.savefig('asdf.png')
    

提交回复
热议问题