Hello. I normally search for answers and try to figure out the problem, that is how I learn, but I can’t seem to figure out how to manipulate a csv table. I have figured out how to read a single line csv document but I have tried for 2 days and still can’t figure out a csv table. I’ll simplify my problem but the concept is still the same.
I have a csv document with 5 rows of data and 10 columns. I figured out how to load that csv table into a variable defined as an empty list (if that is the correct way?). The variable will show 5 elements when I check it so I believe it’s ok. But from there I want to do the following:
- Read each row and using a column (say the 10th index) to run an If-Then test against it to verify if it matches what I am looking for or tests against another regular variable.
- If that row does match then I want to store the entire row of data into a list so I can access it further in the rest of the program.
I have looked up articles on lists/tables but I guess I just can’t grasp the concept or understand what are the key elements of the coding. For example, let’s say the csv document is as follows:
1 aa bb cc dd ee ff gg hh ii
2 11 22 33 44 55 66 77 88 99
3 ab ac ad ae af ag ah ai aj
4 c1 c2 c3 c4 c5 c6 c7 c8 c9
5 zz yy xx ww vv uu tt ss rr
I want to test index 10 of each row, and extract the row of data containing ‘c9’ into a another global list. All the attempts I have tried keeps showing the row I extracted as a single element and not all 10 elements (actually my program has 17 columns). I’m not sure how to do a screen capture on here or I would post it. If anyone can point me to a page showing how to do this or provide a simple routine I will work on figuring it out. Thank you for any help.