首页 > 解决方案 > 我怎样才能选择这个 ime 系列(径流)的 7 月份来绘制?

问题描述

我怎样才能挑选出这些时间序列的 7 月?我的时间序列从 1985 年到 2018 年,右侧是径流值。我需要获得更多代码的帮助,以挑选出 7 月的值,然后绘制它。我的代码:

从熊猫导入 read_csv

将 numpy 导入为 np

将 pandas 导入为 pd 将 matplotlib.pyplot 导入为 plt

导入操作系统

进口汽车

从日期时间导入日期,日期时间

dir1 =“神秘/”

文件 = os.listdir(dir1)

文件 = np.sort(文件)

files_txt = [i for i in files if i.endswith('.txt_')]

df = pd.read_csv(dir1+files_txt[0],skiprows=6,header=None, index_col=0,sep="",na_values=-9999)

df.index = pd.to_datetime(df.index,format="%Y%m%d/%H%M") parse_dates=True

index_col=0

myperiod = df["1985":"2018"]

我的例假

径流

标签: pythonjupyter-notebook

解决方案


推荐阅读