I am trying to loop over ndarray to record index and value of it to postgresql. Here is my code:
for idx, val in enumerate(data):
cur.execute("INSERT INTO public.spams(review_id, label, confidence_level, aoc, created_at) VALUES (%s, %s, %s, %s, %s)", (idx+1, spamlabel, 0, 0, dt.now()))
The size of ndarray is 762k and it tooks more than 8h to insert those values. Is there any more efficient way to do this?