ValueError: DateFormatter found a value of x=0, which is an illegal date.  This usually occurs becau

本文主要是介绍ValueError: DateFormatter found a value of x=0, which is an illegal date.  This usually occurs becau,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

问题:
ValueError: DateFormatter found a value of x=0, which is an illegal date.  This usually occurs because you have not informed the axis that it is plotting dates, e.g., with ax.xaxis_date()
解决办法:

首先,需要将时间格式转换为字符串str(h)
其次,需要将字符串转换为可以识别的时间格式datetime.datetime.strptime(str(h), '%Y-%m-%d %H:%M:%S')
最后,画图的时候横坐标的时间标签代码设置plt.gca().xaxis.set_major_formatter(mdate.DateFormatter('%Y-%m-%d %H:%M:%S'))

在这里插入图片描述

这篇关于ValueError: DateFormatter found a value of x=0, which is an illegal date.  This usually occurs becau的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/364395

相关文章

Anaconda 中遇到CondaHTTPError: HTTP 404 NOT FOUND for url的问题及解决办法

最近在跑一个开源项目遇到了以下问题,查了很多资料都大(抄)同(来)小(抄)异(去)的,解决不了根本问题,费了很大的劲终于得以解决,记录如下: 1、问题及过程: (myenv) D:\Workspace\python\XXXXX>conda install python=3.6.13 Solving environment: done.....Proceed ([y]/n)? yDownloa

jenkins 插件执行shell命令时,提示“Command not found”处理方法

首先提示找不到“Command not found,可能我们第一反应是查看目标机器是否已支持该命令,不过如果相信能找到这里来的朋友估计遇到的跟我一样,其实目标机器是没有问题的通过一些远程工具执行shell命令是可以执行。奇怪的就是通过jenkinsSSH插件无法执行,经一番折腾各种搜索发现是jenkins没有加载/etc/profile导致。 【解决办法】: 需要在jenkins调用shell脚

QT 编译报错:C3861: ‘tr‘ identifier not found

问题: QT 编译报错:C3861: ‘tr’ identifier not found 原因 使用tr的地方所在的类没有继承自 QObject 类 或者在不在某一类中, 解决方案 就直接用类名引用 :QObject::tr( )

java.sql.SQLException: No data found

Java代码如下: package com.accord.utils;import java.sql.Connection;import java.sql.DriverManager;import java.sql.PreparedStatement;import java.sql.ResultSet;import java.sql.ResultSetMetaData;import

SQLException: No Suitable Driver Found - 完美解决方法详解

🚨 SQLException: No Suitable Driver Found - 完美解决方法详解 🚨 **🚨 SQLException: No Suitable Driver Found - 完美解决方法详解 🚨****摘要 📝****引言 🎯****正文 📚****1. 问题概述 ❗****2. JDBC 驱动程序的工作原理 🔧****3. 错误的根本原因 🕵️**

Linux date命令 日期格式化与计算

参考资料 8.4.7 dateコマンド(システムの日付と時刻を表示する)【Linux】dateコマンドで日付フォーマットの変更及び日付計算の方法date コマンド 目录 一. 基本语法1.1 -d 选项1.2 格式化 二. 年月日格式化三. 日计算3.1 一天之前3.2 一天之后 四. 月计算4.1 两个月前的月初4.2 两个月后的月初4.3 指定月份的最后一天4.4 指定月份下个月

为 Key-Value 数据库实现MVCC 事务

ACID是软件领域使用最广泛的技术之一,它是关系数据库的基石,是企业级中间件不可或缺的部分,但通常通过黑盒的方式提供。但是在许多情况下,这种古老的事务方式已经不能够适应现代大规模系统和NoSQL数据库的需要了,现代系统要求更高的性能要求,更大的数据量,更高的可用性。在这种情况下,传统的事务模型被定制的事务或者半事务模型所取代,而在这些模型中事务性并不像以往那样被看重。   在本文中我们会讨论一

el-date-picker年份选择默认值为当前年,并且将获取时间转为年月日格式

<el-date-pickervalue-format="yyyy"v-model="leftQuery.year":disabled="timeArr && timeArr.length != 0 ? true : false"type="year"placeholder="选择年"@change=changeYear:picker-options="pickerOptions"></el-da

the following classes could not be found android.support.v7.internal.

打开XML的界面时候显示 rendering problems: the following classes could not be found android.support.v7.internal.....。 后来发现http://stackoverflow.com/questions/33742114/the-following-classes-could-not-be-fou

兔子-(PHP 5.3 and above) Please set 'request_order' ini value to include C,G and P (recommended: 'CGP'

由于在PHP最新的版本中增加了一个配置项目“request_order”,默认值为“GP”,这个存在一定的安全风险。这里我们建议用户将配置更改为“CGP” 可以在php的安装目录下找到php.ini配置目录,找到下面选项: request_order = "GP"  更改为 request_order = "CGP"   重启服务器后即可。 此