I've got a large (145 MB) CSV file I would like to work with in Python. I'm new to Python, and am trying to wrap my head around the data that csv.reader() gives in the form of an iterator. I've been searching and searching and I've found a ton of information on what an iterator is and how they work, but very little information on how to actually use them when processing data.
I understand the next() method and the whole stop iteration thing, but this just seems like an extremely awkward way to store and retrieve data. Short of running through every row in the iterator in a for loop and appending it to a list (which seems prohibitively cumbersome), I don't really know how to get the data I need out of the iterator, especially considering my data is sorted by column, not row. What is the intended way to use the csv.reader() function, and is there a better way to read the contents of my csv file?
Every time I need a specific data set, am I expected to iterator through and rebuild the iterator tens of thousands of times to get the full column of data I need? I guess I haven't tried that, but it just doesn't seem right...I must be missing something.
lst = list(reader_object). Also you can get any data you want in a single pass so not sure why you think you need repeatedly iterate