python - What is the reason this variable isn't printing? -
This is a program that I am writing. After I get my thinking that loop over my global variable ABSDEV_SUM
Why is not printing
# python_fitness_function = Import Panda PD import itertools infile_path " C: \\ users \\ \\ Tim Dropbox \\ Lela.com_DrBx \\ APR14_query_work \\ "df = pd.DataFrame.from_csv (infile_path +" mp_viewed_item_AGG_affiliate_item_TOP_10.csv "September = ',', index_col = true) groups = df .groupby ( 'Affiliate_ID') df_cameta = groups.get_group ( "Cameta") columns = list (df_cameta.columns) while 'Affiliate_ID' Cols: cols.remove ( 'Affiliat_ID') Motivator_list = [ "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "A "," L "] index = 0 in column for ABSDVIM = 0: column = DF [i] absdiv = yoga (abdominal [1] - pair [0]) for pair pair in ettertols .combinations (column, 2 )) is ABSDEV_SUM = ABSDEV_SUM + AbsDev Print "Motivator_" + Motivator_list [index] "_Mean_AbsDev" Print AbsDev index + = 1 print ABSDEV_SUM
can anyone shed any light me on this for? Sorry if it takes a trivial step.
I get this code when the loop is over:
file "~ \ APR14_query_work \ python_fitness_function.py", line 37, & lt; Module & gt; Print "Motivator_" + Motivator_list [index] "_Mean_AbsDev" IndexError: out of index index limit [exited with exit code in 0.4s]
What do I think It's happening through an additional repetition of the loop, throwing the error out of "boundary", then simply not printing because it ends, I do not know whether this is the case, but I think its I can not understand the reason.
I have tried to manipulate my line around the loop, there is no benefit.
The error message actually means that the Python terminates the program because it is an unreadable exception address Imposes.
The problem is that the value in index
is greater than the number of elements in the value motivational_list
.
(One specific problem is off-by-one - you create an index at the last interval before the end of the list, perhaps because you have started 1 instead of 1? In this case, though It seems that in df_cameta.column.column
you have 12 Motivational_list
. Maybe make the list longer? Or essentially increase it by dynamically? )
Comments
Post a Comment