Python code to do csv file row entries comparison operations and count the number of times row value
        Posted  
        
            by Venomancer
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Venomancer
        
        
        
        Published on 2010-04-29T13:21:55Z
        Indexed on 
            2010/04/29
            13:27 UTC
        
        
        Read the original article
        Hit count: 220
        
python
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 has varying values. 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, fro the csv file i have two columns:
Varying Column; Constant Column 
24              25 
26              25   crossed 
27              25 
26              25
25.5            25 
23              25   crossed 
26              25   crossed 
Thus, the varying column data entries have crossed 25 three times. I need to generate a code that can count the number of the crosses. Please do help out, Thanks.
© Stack Overflow or respective owner