I am unfamiliar with the csv library and the "with open" syntax that I see around online sources including stackoverflow use it for processing csv files.
Here is the "with syntax" I was talking about, it only seems to process the correct amount of lines with this code.
How would I do it with the first block of code shown?
with, other than that you are unfamiliar with it? If unfamiliarity is the only issue, you can try becoming familiar with it by reading more about context mangers and code examples. Unless the closure of the file handle needs to be done outside the code block that opens it, there is no good reason not to usewith.open()withoutwithyou'll have toclose()it as well!for value in values:, you don't use thevalue, and append the row to yourdataarray. I think you should get rid of that loop and replace it withdata.append(values).