在jupyter笔记本中保存熊猫的情节

时间:2018-05-08 21:46:36

标签: python pandas matplotlib jupyter-notebook pandas-groupby

我正试图在一个jupyter笔记本中保存一个熊猫数据帧的情节,但我得到一个72字节大小的空白图像。

以下是我正在使用的代码:

    EperDtDF = spark.sql("SELECT timestamp, data.ldr from deviceData where timestamp >= '2018-05-01T00:00:00+02:00' and timestamp < '2018-05-07T23:59:59+02:00'")
    EperDtDF.cache()
    EperDtPanda = EperDtDF.toPandas().set_index('timestamp')
    slice = EperDtPanda[0:4321].plot() # slice of first 6h (double of previous calculation)

    fig = slice.get_figure()
    fig.savefig('test2', format='png')

创建的文件在那里,名称正确,但只有72字节,我无法打开它,因为它是一个空白图像。

如何保存以正确方式显示的情节?

0 个答案:

没有答案