import csv
from matplotlib import pyplot as plt
from datetime import datetime
filename = 'sitka_weather_2018_simple.csv'
with open(filename) as f:
reader = csv.reader(f)
header_row = next(reader)
#从文件获取最高气温
dates,highs = [],[]
for row in reader:
current_date = datetime.strptime(row[2],"%Y-%m-%d")
dates.append(current_date)
high = int(row[5])
highs.append(high)
print(highs)
#根据数据绘制图形
fig = plt.figure(dpi=128,figsize = (10,6))
plt.plot(dates,highs,c='red')
#设置图形格式
plt.title("Daily high temperatures,2018",fontsize = 24)
plt.xlabel('',fontsize =16)
plt.ylabel('Temperature (F)',fontsize =16)
fig.autofmt_xdate()
plt.tick_params(axis='both',which='major',labelsize=16)
plt.show()
详细解决方案
time data ‘2018/1/1‘ does not match format ‘%Y-%m-%d‘
热度:35 发布时间:2024-03-06 13:51:12.0
相关解决方案
- Spring Data 的有关问题
- 数据库 connect time out解决方案
- https下session time out后,无法再次登陆,该如何处理
- spring data jpa查询有关问题
- f.format 简单有关问题
- var das = eval("(" + data + ")"); 提示语法异常求解
- !odac140.bpl it is not design time package
- js转json,eval('(' + data + ')')事先和之后的数据不一致~
- 命名空间“System.Data”中不存在门类或命名空间名称“Linq”(是否缺少程序集引用?)
- 没法将类型“System.Data.DataSet”隐式转换为“System.Collections.Generic.List
- 没法将类型“bool”隐式转换为“System.Data.DataTable
- System.Data.SqlClient.SqlDataReader”未定义构造函数解决方法
- 无法从“string”转换为“System.Data.DataColumn[]解决方法
- System.Data.OracleClient.OracleException: ORA-01841: (完整) 年份值必须介于 -4713 和 +9999解决方法
- ComponentArt:Grid 单击第二页时 报the data could not be loaded,该如何处理
- 无法将类型“System.Data.SqlClient.SqlDataReader”隐式转换为“int”,该怎么解决
- vs2010如何找不到System.data.oracleClient
- 如何不能引用System.Data
- 发布dll,访问提示异常The located assembly's manifest definition with name 'Copy of TCL" does not match the assembly reference
- update voter set time=#2007/04/28# 14:04:44# where id=1 错在哪了 请大哥指点,该如何解决
- 无法将类型“System.Data.SqlClient.SqlCommand”隐式转换为“string”,该怎么处理
- format() 怎么格式化字符窜的长度
- The conversion of a char data type to a datetime data type resulted in an out-of-range datetime解决方案
- vs2005中global.asax中在哪平添using System.Data.SqlClient;
- DDN String.Format 中能转义 { & } 吗?接分啊兄弟们^该怎么处理
- XXX对象无法强制转换成“System.Data.DataRowView”2天了还没解决,该怎么解决
- 无法从int隐转换到System.Data.SqlClient.解决思路
- 如何在aspx页面 如(login.aspx)引用命名空间(System.data.sqlclient)
- 小弟我想将数据绑定到dropdownlist中,可是下拉列表出现的是System.Data.
- <%# string.Format("{0} " Eval("Name")) %> 与 <%# Eval("Name") %> 有什么区别?该如何处理