预先感谢您的帮助!(下面的代码)(链接到第一个数据)(链接到我要添加的数据)
我正在尝试从第二个 CSV(上图)导入数据,并根据该 CSV 数据向该图添加第二行。执行此操作的最佳方法是什么?(下图)
图上的波浪线代表数据的范围。
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import warnings
warnings.filterwarnings('ignore')
raw_data = pd.read_csv('all-deep-soil-temperatures.csv', index_col=1, parse_dates=True)
df_all_stations = raw_data.copy()
selected_soil_station = 'Minot'
df_selected_station = df_all_stations[df_all_stations['Station'] == selected_soil_station]
df_selected_station.fillna(method = 'ffill', inplace=True);
df_selected_station_D=df_selected_station.resample(rule='D').mean()
df_selected_station_D['Day'] = df_selected_station_D.index.dayofyear
mean=df_selected_station_D.groupby(by='Day').mean()
mean['Day']=mean.index
maxx=df_selected_station_D.groupby(by='Day').max()
minn=df_selected_station_D.groupby(by='Day').min()
mean['maxx20']=maxx['20 cm']
mean['minn20']=minn['20 cm']
plt.style.use('ggplot')
bx = mean.plot(x='Day', y='20 cm',color='black')
plt.fill_between(mean['Day'],mean['minn20'],mean['maxx20'],color='blue',alpha = 0.2);
bx.set_xlabel("Day of the year")
bx.set_ylabel("Temperature in Celsius")
bx.set_title("Soil Temp, Air Temp, and Snow Depth for " + str(selected_soil_station))
我拥有的:
我想要拥有什么:
料青山看我应如是
相关分类