Hi,
I am trying to resample data by converting them from annual to monthly, quarterly etc. As indicated below, I have been able to import the data with the appropriate codes using Jupyter. However, I am getting error messages when I use the resample function, file.resample("M").mean(). The error message is also pasted below. I wanted to ask if anyone can offer any assistance on how to overcome this problem.
Thank you
---------------------------------------------------------------------------
I am trying to resample data by converting them from annual to monthly, quarterly etc. As indicated below, I have been able to import the data with the appropriate codes using Jupyter. However, I am getting error messages when I use the resample function, file.resample("M").mean(). The error message is also pasted below. I wanted to ask if anyone can offer any assistance on how to overcome this problem.
Thank you
import pandas as pd file = pd.ExcelFile("F:/ArcCentre/Data/Ghana/Economy/GDP.xlsx") index_col="Date" df1 = file.parse('Sheet1') df1.head(10)
Output:Date Growth
0 1961.0 3.429674
1 1962.0 4.109159
2 1963.0 4.405974
3 1964.0 2.209328
4 1965.0 1.368999
5 1966.0 -4.258290
6 1967.0 3.075364
7 1968.0 0.368860
8 1969.0 6.006175
9 1970.0 9.723473
file.resample("M").mean()---------------------------------------------------------------------------
Error:AttributeError Traceback (most recent call last)
<ipython-input-17-846ab9556fef> in <module>
----> 1 file.resample("M").mean()
AttributeError: 'ExcelFile' object has no attribute 'resample'