title: Comparing boolean values in pandas dataframe
body: <p><a href="https://i.stack.imgur.com/CSpXI.png" rel="nofollow noreferrer">example of dataframe</a>I have a pandas dataframe that contains boolean values. This information is about the users' activity in system. Columns represent the time and rows - users' IDs. True value if user was active in that time and false if he was not. I would like to assign status instead of boolean values. 
  For example, if user was active, status is 1, if he was not active for certain time status is 0, and user left the system - status is -1. Difference between inactive user and who left the system is that for inactive user False followed later by True, while for those who left the system it is always False. </p>
  
  <p>Input looks like:</p>
  
  <pre><code>inputt = pd.DataFrame([[True, False, False, False], [True, False, True, True]])
  </code></pre>
  
  <p>Expected output is something like:</p>
  
  <pre><code>output = pd.DataFrame([[1, -1, -1, -1], [1, 0, 1, 1]])
  </code></pre>
  
  <p>I tried to write the function that checks the following column and assign the status based on it as:</p>
  
  <pre><code>def row_to_status(row, columns=range(2,25)):
  # -1 = dead, 0 = inactive, 1 = alive
  status_row = []
  for column in columns:
      status = 1
      if not row[column]:
          status = -1
          next_cols = range(column+1, columns[-1]+1)
          if row[next_cols].sum():
              status = 0
      status_row.append(status)
  return status_row
  </code></pre>
  
  <p>However, it gives me errors about using the range. Range(2,25) is used for the iterating through the columns. </p>
  
  <p>Please help me to solve this problem. Thanks!  </p>