Код: Выделить всё
#Dataframe 1: Before time column converted to datetime

Код: Выделить всё
#After column converted to datetime and subset the dataframe to 2022 data only
scaled_pwrts['Timestamp'] = pd.to_datetime(scaled_pwrts['Timestamp'],utc=True)
hindcast_2022=scaled_pwrts["01-01-2022":"12-31-2022"]


Код: Выделить всё
#Dataframe 2: before column converted to datetime

Код: Выделить всё
#After conversion to datetime
realized_production["DELIVERY_START"] = pd.to_datetime(realized_production["DELIVERY_START"],utc=True)
Код: Выделить всё
#Loop over every month and plot the line timeseries for "hindcast_2022" and "realized_production" dataframes.
fig = plt.figure(figsize=(40, 30))
for i in np.arange(1,13):
hindcast_2022_i = (hindcast_2022["Gross Power"])[hindcast_2022.Timestamp.dt.month==i]
actual_2022_i = realized_production["DERMOTT"] [realized_production.DELIVERY_START.dt.month==i]
ax= plt.subplot(6,2,i)
(hindcast_2022_i/1000).plot(ax=ax,label="hindcast")
actual_2022_i.plot(ax=ax,label="actual")
ax.set_title("Month= "+str(i))
ax.legend()

Подробнее здесь: https://stackoverflow.com/questions/790 ... -up-python