我试图在python中使用matplotlib创建一个随时间变化的直方图。 我有一个数组日期时间。日期时间物体。在
2016-01-16 11:50:01
2016-01-16 11:48:34
2016-01-16 11:48:28
2016-01-16 11:44:29
我已经仔细检查过了日期时间。日期时间. 在
^{pr2}$下面是我的代码片段:
f1 = plt.figure()
ax1 = f1.add_subplot(111)
ax1.hist(arrayofdates, bins=50, color='lightblue')
在“ax1.hist….”行,我得到这个错误输出
File "akpsql.py", line 131, in create_histograms ax1.hist(arrayofdates, bins=50, color='lightblue') File "/usr/lib/pymodules/python2.7/matplotlib/axes.py", line 8312, in hist xmin = min(xmin, xi.min()) TypeError: can't compare datetime.datetime to float
问题是,当我用10左右的小数组在我的虚拟机上测试时,这段代码工作得非常好。在
然而,当我在服务器上尝试更大的样本时,大约有8000多个结果。在
有办法解决这个问题吗?
有没有一种更理想的方法来绘制频率随时间的变化(特别是在有巨大结果的情况下)?比如垃圾箱大小会是个问题吗?)
提前谢谢
编辑:
在这个数组中使用10个相同的数组替换这个数组中的确切日期
已确认数组中的所有条目都日期时间。日期时间对象
确认的matplotlib是最新的
目前没有回答
相关问题 更多 >
编程相关推荐