title: How to replace NULL/? with 'None' or '0' in r
body: <p>DF1 is</p>
  
  <pre><code>ID CompareID Distance
  1  256          0
  1  834          0
  1  946          0
  2  629          0
  2  735          1
  2  108          1
  </code></pre>
  
  <p>Expected output should be DF2 as below (Condition for generating DF2 -> In DF1, For any ID if 'Distance'==1, put the corresponding 'CompareID' into 'SimilarID' column, for 'Distance'==0, ignore the corresponding 'CompareID')</p>
  
  <pre><code>   ID SimilarID
      1  None
      2  735,108
  </code></pre>
  
  <p>Comparison is done correctly , but i got below output</p>
  
  <pre><code>   ID SimilarID
      1  ?
      2  735,108
  </code></pre>
  
  <p>I understood that, as there are no 'CompareID' to put in 'SimilarID' - ? mark is displayed.
  I want to replace this '?' with 'None' or '0'. Kindly help
  In some cases, i observe that instead of '?' i can also see 'NULL' value. </p>
  
  <p>Thanks !</p>