Table_Data_Extraction icon indicating copy to clipboard operation
Table_Data_Extraction copied to clipboard

the code is not working its gives an error

Open Abdullah-000 opened this issue 3 years ago • 4 comments

boxes_list = [] for i in range(len(rows)): l=[] for k in range(total_cells): l.append([]) for j in range(len(rows[i])): diff = abs(center-(rows[i][j][0]+rows[i][j][2]/4)) minimum = min(diff) indexing = list(diff).index(minimum) l[indexing].append(rows[i][j]) boxes_list.append(l) for box in boxes_list: print(box)

8 minimum = min(diff) 9 indexing = list(diff).index(minimum) ---> 10 l[indexing].append(rows[i][j]) 11 boxes_list.append(l) 12 for box in boxes_list:

IndexError: list index out of range

Abdullah-000 avatar Jun 01 '22 04:06 Abdullah-000

Same here! Could you find a solution for it? @Abdullah-000 @Soumi7

raminmardani avatar Jun 13 '22 16:06 raminmardani

this error happens in some specific images. For the example image which is in the repo, there would be no issue!

raminmardani avatar Jun 13 '22 16:06 raminmardani

It is the bug. I fixed these bugs after several hours. 😭

superzw avatar Mar 29 '24 06:03 superzw

I'm not sure how accurate this is but I swapped out

for i in range(len(row)):
  if len(row[i]) > total_cells:
    total_cells = len(row[i])

with

total_cells = len(max(rows, key=len))

Basically, taking the max of the cells not the items in each cell.

N00bie-to-Github avatar Apr 19 '24 20:04 N00bie-to-Github