Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/298.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 用xlim绘制多层分组测向图_Python_Pandas_Plot_Multi Level - Fatal编程技术网

Python 用xlim绘制多层分组测向图

Python 用xlim绘制多层分组测向图,python,pandas,plot,multi-level,Python,Pandas,Plot,Multi Level,我有一个2019年每小时值的图。在x轴上使用日期子集(仅一月)打印时,我的打印将变为空白 我有一个DF,我在行轴上根据时间索引中的月份和小时对特定列“SE3”进行分组。分组看起来不错 现在,我想策划。情节看起来可能不错,但我只想放大一个月。基于另一篇关于stackoverflow的文章,我使用set_xlim 那么我的情节就什么都没有了 #Grouping of DF df['SE3'].groupby([df.index.month, df.index.hour]).mean().round(

我有一个2019年每小时值的图。在x轴上使用日期子集(仅一月)打印时,我的打印将变为空白

我有一个DF,我在行轴上根据时间索引中的月份和小时对特定列“SE3”进行分组。分组看起来不错

现在,我想策划。情节看起来可能不错,但我只想放大一个月。基于另一篇关于stackoverflow的文章,我使用set_xlim

那么我的情节就什么都没有了

#Grouping of DF
df['SE3'].groupby([df.index.month, df.index.hour]).mean().round(2).head()
分组测向图

预期的结果是显示相同的图,但现在只显示1月份。相反,图形变为空白。然而,数据显示 (737060.0416666666737090.9583333334),似乎是日期数据

不带设置的图片

带有set_xlim的图片(空)

当我理解为什么我的图是空白的时候,我的最终目标是显示每个月的小时平均值,如下所示:

#Plotting and setting new, shorter in time x-axis
ax=df['SE3'].groupby([df.index.month, df.index.hour]).mean().round(2).plot()
ax.set_xlim(pd.Timestamp('2019-01-01 01:00:00'), pd.Timestamp('2019-01-31 23:00:00'))