【发布时间】:2021-05-04 19:03:19
【问题描述】:
我想循环遍历轴(0 到 5 和 0 到 1),以及循环遍历我的系列表 (Pandas) 的列。
我的想法是按照以下思路做一些事情:
for i in range(3):
for j in range(2):
sm.graphics.tsa.plot_acf(series['GBP'], ax[i,j], lags=15, zero=False)
但是,这使我无法遍历系列表。这就是我目前的做法:
sm.graphics.tsa.plot_acf(series['GBP'], ax[0,0], lags=15, zero=False)
sm.graphics.tsa.plot_acf(series['JPY'], ax[0,1], lags=15, zero=False)
sm.graphics.tsa.plot_acf(series['DEM'], ax[1,0], lags=15, zero=False)
sm.graphics.tsa.plot_acf(series['BEF'], ax[1,1], lags=15, zero=False)
sm.graphics.tsa.plot_acf(series['FRF'], ax[2,0], lags=15, zero=False)
sm.graphics.tsa.plot_acf(series['ITL'], ax[2,1], lags=15, zero=False)
sm.graphics.tsa.plot_pacf(series['GBP'], ax[3,0], lags=15, zero=False)
sm.graphics.tsa.plot_pacf(series['JPY'], ax[3,1], lags=15, zero=False)
sm.graphics.tsa.plot_pacf(series['DEM'], ax[4,0], lags=15, zero=False)
sm.graphics.tsa.plot_pacf(series['BEF'], ax[4,1], lags=15, zero=False)
sm.graphics.tsa.plot_pacf(series['FRF'], ax[5,0], lags=15, zero=False)
sm.graphics.tsa.plot_pacf(series['ITL'], ax[5,1], lags=15, zero=False)
应该有一个更有效的方法,我只是无法理解它。提前致谢!
【问题讨论】:
标签: python pandas matplotlib