Note that there are some explanatory texts on larger screens.

plurals
  1. PORead CSV and Separate by column
    primarykey
    data
    text
    <p>Brand new to Python (and programming in general), if this is simple and/or answered somewhere I didn't find, feel free to harass me in typical forum fashion.</p> <p>I've got a bunch of CSVs, each containing 10 XY coordinates like this:</p> <pre><code>10,5 2,4 5,6 7,8 9,12 3,45 2,4 6,5 0,3 5,6 </code></pre> <p>I'm looking to separate the X coordinates and Y coordinates into two seperate lists, so that I can subtract a value from each value in a given list. For example, subtracting 5 from every value in the X coordinate list and 3 from every value in the Y coordinate list. I'm then going to take the abs() of each value and find the minimum. Once those minimums are found, I want to add the lists together so that each value is added to it's counterpart</p> <p>IE) if the absolute values of X were something like</p> <pre><code>4 5 .... </code></pre> <p>and Y something like</p> <pre><code>6 7 .... </code></pre> <p>I'd want to add 4 and 6, then 5 and 7, etc. </p> <p>To separate them, I tried </p> <pre><code>import csv filein = open("/path/here") reader = csv.reader(filein, skipinitialspace = True) listofxys = [] for row in reader: listofxys.append(row) Xs = listofxys.pop(0) # to pop all the X's Ys = listofxys.pop() # to pop all the Y's </code></pre> <p>But instead of all the leading values, it provides the first XY pair. What am I doing wrong here?</p> <p>The eventual goal is to find the closest point to an XY coordinate, so if this is a bad way to go about it, feel free to steer me in another direction. </p> <p>Thanks in advance!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload