第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

繪制額外的 Pandas DF

繪制額外的 Pandas DF

大話西游666 2023-03-08 17:11:54
我有如下所示的代碼,我試圖在 7 月 - 12 月顯示的繪圖上為 df“l(fā)tyc”中的數(shù)據(jù)畫一條黑線。我的錯(cuò)誤是在 plt.legend 行之前的最后.import warningsimport itertoolsimport numpy as npimport matplotlib.pyplot as pltwarnings.filterwarnings("ignore")plt.style.use('fivethirtyeight')import pandas as pdimport statsmodels.api as smimport matplotlibmatplotlib.rcParams['axes.labelsize'] = 14matplotlib.rcParams['xtick.labelsize'] = 12matplotlib.rcParams['ytick.labelsize'] = 12matplotlib.rcParams['text.color'] = 'k'from sys import exitdf = pd.read_excel("MOSDailyWindSpeed.xlsx")wspdBH1 = df.groupby('Date')[' Simulated WS BH1PI'].sum().reset_index()wspdHOO = df.groupby('Date')[' Simulated WS HOO801'].sum().reset_index()wspdBH1 = wspdBH1.set_index('Date')wspdHOO = wspdHOO.set_index('Date')wspdBH1.indexwspdHOO.indexy = wspdHOO[' Simulated WS HOO801'].resample('MS').mean()#monthly mean --> change site here 'MS' is month start for 'Date' coly['2017':]#look at daily data starting 2017 -view data y.plot(figsize=(15, 6))plt.show()from pylab import rcParamsrcParams['figure.figsize'] = 18, 8decomposition = sm.tsa.seasonal_decompose(y, model='additive')fig = decomposition.plot()plt.show()p = d = q = range(0, 2)pdq = list(itertools.product(p, d, q))seasonal_pdq = [(x[0], x[1], x[2], 12) for x in list(itertools.product(p, d, q))]print('Examples of parameter combinations for Seasonal ARIMA...')print('SARIMAX: {} x {}'.format(pdq[1], seasonal_pdq[1]))print('SARIMAX: {} x {}'.format(pdq[1], seasonal_pdq[2]))print('SARIMAX: {} x {}'.format(pdq[2], seasonal_pdq[3]))print('SARIMAX: {} x {}'.format(pdq[2], seasonal_pdq[4]))for param in pdq:  for param_seasonal in seasonal_pdq:    try:        mod = sm.tsa.statespace.SARIMAX(y,                                        order=param,                                        seasonal_order=param_seasonal,                                        enforce_stationarity=False,                                        enforce_invertibility=False)
查看完整描述

1 回答

?
holdtom

TA貢獻(xiàn)1805條經(jīng)驗(yàn) 獲得超10個(gè)贊

我用它來將整數(shù)日期轉(zhuǎn)換為 DF 中的 yyyy-mm-dd 格式。ltyc['Date'] = pd.to_datetime(ltyc["Date"], format='%m').apply(lambda dt: dt.replace(year=2020))

然后,我將 DF (ltyc) 轉(zhuǎn)換成這樣的系列: ltycs = pd.Series(ltyc['LT Mean'].values, index=ltyc['Date'])#convert to Series 因?yàn)槠渌麍D都在系列格式

ltycs.plot(label='LT Mean',ax=ax,color='k')


查看完整回答
反對(duì) 回復(fù) 2023-03-08
  • 1 回答
  • 0 關(guān)注
  • 132 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)