for loop after specific index with python not working -


Then I have a piece of code that is changing to data in the toplex through dataframe and before each value Runs again Tomorrow everything was working fine, but today, with some lines it is not leaving the first index and I do not know why.

Here is the code:

  in the data for the rows .tartup (): r = int (lines [0]) in 1 rows I [1:]: c = Rows.index (i) print r, i, c, int (rows.index (i)), rows  

I have copied the print out of the first two lines of print The line works perfectly. There was a problem in the second row, what is expected is that 1 will be set for the first element, which increased the line [1], but instead 0 is. It is randomly happening through lines of dataframe. Does anyone have any idea why the first element is not left for the loop? 1 3 1 1 (0, 3, 27000, '1060', 'QMS', 'test' 'day', 'LMT') 1 1 3 1 27000 2 2 (0, 3, 27000, '1060', 'QMS', 'test', 'day', 'LMT') 1 2 27000 1 1060 3 3, 3, 27000, '1060', 'QMS', 'Test', ' Day ',' LMT ') 1 3 1060 1 QMS 4 4 (0, 3, 27000,' 1060 ',' QMS ',' Test ',' Day ',' LMT ') 1 4 QMS 1 ARCA5 5 (0 , 3, 27000, '1060', 'QMS', 'Examination', 'Day', 'LMT') 1 5 RCA Day 1 6 6 (0, 3, 27000, '1060', 'QMS', 'Test' , 'Day', 'LMT') 1 6 days 1 LMT 7 7 (0, 3, 27000, '1060', 'QMS' 'Test', 'Day', 'LMT') 1 7 Lmt ** 2 1 0 0 (1, 1, 3500, '1060', ' QMS ',' Examination ',' Day ',' LMT ') ** 2 0 1 2 3500 2 2 (1, 1, 3500,' 1060 ',' QMS ',' Test ',' Day ',' LMT ' ) 2 2 3500 2 1060 3 3 (1, 1, 3500, '1060', 'QMS', 'Exam', 'Day', 'LMT')

rows. The first item will be found in rows in the value i . When you reach your second rows collection, rows [0] rows, then rows.indx (1) will reach zero rows [1] is also equal to one.

If you want to redo the index and values ​​of an indicator, then I suggest using the enumerate. For rows in the data .tartup (): r = int (rows [0]) + 1 for c, i in enumerate (rows): # cip the first value if c = = 0: Continue #do whatever for rows in data

or

  .tartup (): r = int (lines [0] ) + 1 for C, I enumerate (in lines [1:], 1): # Skip the first object, do anything here  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -