Python CSV file processing

Posted by kingwarchief on Stack Overflow See other posts from Stack Overflow or by kingwarchief
Published on 2010-04-28T14:06:03Z Indexed on 2010/04/28 14:23 UTC
Read the original article Hit count: 219

Filed under:

I just got introduced to python, the first language I get to learn, and I have this question below:

I have an excel based CSV file with two columns (or rows, Pythonically) that I am working on. What I need to do is to perform some operations so that I can compare the two data entries in each 'row'. To be more precise, one column has constant numbers all the way down, whereas the other column varies. So I need to count the number of times the varying column data entry values crosses the constant value on the other column.

For example:

Varying Column; Constant Column
24              25
26              25   crosses
27              25
26              25            
25.5            25
23              25   crossed
26              25   crossed

So in this case the number of times there is a cross

© Stack Overflow or respective owner

Related posts about python