title: HOW TO PERFORM BELOW EXCEL FUNCTION IN PYTHON (if function inside if function)
body: <p><strong>=IF(C2&lt;&gt;C1,&quot;&quot;,IF(J2=J1,&quot;&quot;,&quot;dif&quot;))</strong>
  <strong>I have tried below code but still iam not getting accurate output</strong>
  How to perform above excel formula in python.</p>
  <pre><code>data['d'] = data['C'].shift(1)==data['C']
  data['d'] = data['C'].shift(1)==data['C']
  data['d'] = data['d'].replace(False,'0')
  data['d'] = data['d'].replace(True,'1')
  data['e'] = data['J'].shift(1)==data['J']
  data['e'] = data['e'].replace(False,'1')
  data['e'] = data['e'].replace(True,'2')
  data['K'] = data['d'] == data['e']
  data['K'] = data['K'].replace(False,' ')
  data['K'] = data['K'].replace(True,'dif')
  </code></pre>