请选择 进入手机版 | 继续访问电脑版
爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 14267|回复: 3

[求助] 截个图总发不出去,说有什么敏感词。哎。

[复制链接]

新浪微博达人勋

发表于 2021-9-8 13:36:01 | 显示全部楼层 |阅读模式

登录后查看更多精彩内容~

您需要 登录 才可以下载或查看,没有帐号?立即注册 新浪微博登陆

x
     05:00:00   0.0  24.0  82   0.0
1   05:05:00   0.0  24.1  82   0.5
2   05:10:00   0.0  24.0  82   0.5
3   05:15:00   0.0  24.0  82   0.5
4   05:20:00   0.0  23.9  76   1.5
5   05:25:00   0.0  24.0  74   0.8
6   05:30:00   0.0  23.9  74   1.2
7   05:35:00   0.0  23.8  75   1.2
8   05:40:00   0.0  23.7  75   0.5
9   05:45:00   0.1  23.3  79   0.9
10  05:50:00   0.3  22.7  84   0.6
11  05:55:00   1.1  22.2  87   0.0
12  06:00:00   0.8  22.0  89   0.7
13  06:05:00   9.4  21.7  90   1.9
14  06:10:00   3.4  21.6  90   1.0
15  06:15:00   2.6  21.5  90   1.4
16  06:20:00   1.1  21.6  91   0.7
17  06:25:00   1.3  21.6  91   1.0
18  06:30:00   2.1  21.5  91   1.0
19  06:35:00   7.2  21.5  91   1.5
20  06:40:00   9.6  21.5  91   0.9
21  06:45:00  14.9  21.1  91   1.1
22  06:50:00  15.2  20.6  91   1.1
23  06:55:00   8.1  20.7  91   1.1
24  07:00:00   6.1  20.9  91   0.8

作图,怎么实现用第一列,即时间列为x轴。
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2021-9-8 16:23:19 | 显示全部楼层
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import matplotlib.dates as mdate

plt.rcParams['font.sans-serif']=['SimHei'] #用来正常显示中文
plt.rcParams['axes.unicode_minus']=False #用来正常显示负号

##数据准备(文件读取 → 数据清洗)
df=pd.read_csv('data/58606_201903.csv')
df['Time']=pd.to_datetime(df['Time'])
t=np.array(df['Time'])    #t = [datetime.strptime(d, '%Y/%m/%d %H:%M') for d in df['时间']]
tmp=np.array(df['Temperature'])
prs=np.array(df['Pressure'])
#rain=np.array(df['Rain'])
rain=df['Rain'].replace(9999,0.0)
td=np.array(df['Dew'])

##绘图部分
#画布“第一”!
#fig, ((ax1,ax2),(ax3,ax4))= plt.subplots(2,2,figsize=(9,5),dpi=100)

fig=plt.figure()
ax=fig.add_axes([0.05,0.05,0.8,0.8])
line1,=ax.plot(t, tmp, 'r-',linewidth=3.,label='气温')
plt.legend((line1,line2),('气温', '露点'), loc='best')
plt.title('南昌站实况时序图2')
ax.xaxis.set_major_formatter(mdate.DateFormatter('%d-%H'))
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

 楼主| 发表于 2021-10-12 16:29:39 | 显示全部楼层
老李大神。
牛啊。
我近期一直在看您在优酷上的视频。
好好学习啊。
焦躁的再等您的书。
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

 楼主| 发表于 2021-10-12 16:58:26 | 显示全部楼层
edwardli 发表于 2021-9-8 16:23
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd

大神,请教您一个问题,着急中。
我画气象观测站点风速风向随时间变化的一个序列图。
我在网上看到一个帖子,运行它的代码,能顺利实现。
但是数据换成我自己的数据的后,风速能体现出来,但是风向显示不出来。
也不知道问题出在哪里。

您帮忙根据下面的提示错误信息,指导下我怎么修改啊。

Name: Date_Time, Length: 5712, dtype: int64
Traceback (most recent call last):

  File "C:\Anaconda\anaconda3\lib\site-packages\pandas\core\indexes\range.py", line 351, in get_loc
    return self._range.index(new_key)

ValueError: 0 is not in range


The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "E:\Pycode\scripte_practice\Report_jiaoan\PM_wind_time_seires.py", line 99, in <module>
    drow_wind_heatmap(wind_direction,wind_speed,x_time)

  File "E:\Pycode\scripte_practice\Report_jiaoan\PM_wind_time_seires.py", line 86, in drow_wind_heatmap
    if wd != 3539 or ws!=0:

  File "C:\Anaconda\anaconda3\lib\site-packages\pandas\core\series.py", line 853, in __getitem__
    return self._get_value(key)

  File "C:\Anaconda\anaconda3\lib\site-packages\pandas\core\series.py", line 961, in _get_value
    loc = self.index.get_loc(label)

  File "C:\Anaconda\anaconda3\lib\site-packages\pandas\core\indexes\range.py", line 353, in get_loc
    raise KeyError(key) from err

KeyError: 0


runfile('E:/Pycode/scripte_practice/Report_jiaoan/wind_heatmap01.py', wdir='E:/Pycode/scripte_practice/Report_jiaoan')


密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

快速回复 返回顶部 返回列表