IndexError: single positional indexer is out-of-bounds for my Pandas Dataframe
IndexError: single positional indexer is out-of-bounds for my Pandas Dataframe I am trying to perform certain addition operation to the columns in my dataframe and then store the values within the same dataframe. My DataFrame has 3796 rows and 11 columns containing data from the year 1928 till 2000, with weekly data. I want to take a weighted average of the data points(depending upon their dates) and store the values in the same dataframe. My code is as follows: import pandas as pd import numpy as np df=pd.read_excel("D:SUMMER INTERNSHIP CONCORDIAUpdated Work hereKitsim Reservoir (Number 220)Book3_Final.xlsx") a=0 b=0 k=20 p=3 for z in range(3,11): a=0 b=0 for x in range(1928,2000): for y in range(0,12): if df.iloc[a,1]==1: df.iloc[b,k]=(7*df.iloc[a,z]+7*df.iloc[a+1,z]+7*df.iloc[a+2,z]+7*df.iloc[a+3,z]+3*df.iloc[a+4,z])/31 a=a+4 b=b+1 if df.iloc[a,1]==2: ...
