[ad_1]
I am practicing the coding with “Machine Learning for Financial Risk Management with Python Algorithms for Modeling Risk (Abdullah Karasan)” in Chapter 1. I have successfully accessed the time series data of energy capacity utilization from the FRED for the period of 2010–2020, and followed the codes on book to remove its seasonality. However, One error occurred when I tried to resample the energy series with the following codes, for which I failed to find relevant solutions:
In [10]: from fredapi import Fred
import statsmodels.api as sm
In [11]: fred = Fred(api_key='insert you api key')
In [12]: energy = fred.get_series("CAPUTLG2211A2S",observation_start="2010-01-01",observation_end="2020-12-31")
In [20]: seasonal_index = energy.resample('Q').mean()
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-44-a3904e416c86> in <module>
----> 1 seasonal_index = energy.resample('Q').mean()
2 seasonal_index
D:\anaconda\lib\site-packages\pandas\core\generic.py in resample(self, rule, how, axis, fill_method, closed, label, convention, kind, loffset, limit, base, on, level)
ModuleNotFoundError: No module named 'pandas.core.resample'
I am a beginner of Python in Finance working on this topic solely, so I have no ideas of this problem.
[ad_2]