In the code below I'm iterating over the columns of a Pandas dataframe. For each column I did some operations. After doing operations on the last column I want to get back to the first column of the dataframe and again iterate over each column one by one from an increased location of j 512. How can I do that?
for column in df:
j=0
col_one_list = df[column].tolist()
mav1 = mav(col_one_list[j:j 256])
mav2 = mav(col_one_list[j 256:j 256 256])
CodePudding user response:
loop_time = 3
j = 0
for i in range(loop_time):
for column in df:
col_one_list = df[column].tolist()
mav1 = mav(col_one_list[j:j 256])
mav2 = mav(col_one_list[j 256:j 256 256])
j =512