title: Calculate diffrence between two dates
body: <p>I have a DB with two date column (Y-m-d):</p>
  
  <pre><code>Date_from    Date_to     
  17/01/01     17/01/05       
  17/02/03     NaN           
  17/05/01     17/05/05       
  ...
  </code></pre>
  
  <p>Date_from and Date_to are pandas column.</p>
  
  <p>I built a function that if:
  - in Date_to there NaN returns me "corrence";
  - in Dta_to there is no Nan makes the difference between the two columns</p>
  
  <p>Both results are saved in a third column. Like this:</p>
  
  <pre><code>Data_from    Date_to     Difference
  17/01/01     17/01/05       4
  17/02/03     NaN           corrence    
  17/05/01     17/05/05       4
  ...
  </code></pre>
  
  <p>The function is this:</p>
  
  <pre><code>from datetime import datetime
  
  def diff(data,d1, d2):
      if pd.isnull(data.iloc[[1],[12]]):
           data['difference'] = 366
      else:
           data[d1] = pd.to_datetime(data[d1])
           data[d2] = pd.to_datetime(data[d2])
           data['difference'] = data[d2] - data[d1]
      return data
  
  d1 = ["Date_from"]
  d2 = ["Date_to"]
  df = replace_NaN(df,d1,d2)  
  </code></pre>
  
  <p>The error that get out is this:</p>
  
  <pre><code>TypeError: replace_NaN() takes 2 positional arguments but 3 were given
  </code></pre>
  
  <p>I don't understand why</p>