title: Python numpy: cannot convert datetime64[ns] to datetime64[D] (to use with Numba)
body: <p>I want to pass a datetime array to a Numba function (which cannot be vectorised and would otherwise be very slow). I understand Numba supports numpy.datetime64. However, it seems it supports datetime64[D] (day precision) but not datetime64[ns] (millisecond precision) (I learnt this the hard way: is it documented?).</p>
  
  <p>I tried to convert from datetime64[ns] to datetime64[D], but can't seem to find a way! Any ideas?</p>
  
  <p>I have summarised my problem with the minimal code below. If you run <code>testdf(mydates)</code>, which is datetime64[D], it works fine. If you run <code>testdf(dates_input)</code>, which is datetime64[ns], it doesn't. Note that this example simply passes the dates to the Numba function, which doesn't (yet) do anything with them. I try to convert dates_input to datetime64[D], but the conversion doesn't work. In my original code I read from a SQL table into a pandas dataframe, and need a column which changes the day of each date to the 15th.</p>
  
  <pre><code>import numba
  import numpy as np
  import pandas as pd
  import datetime
  
  mydates =np.array(['2010-01-01','2011-01-02']).astype('datetime64[D]')
  df=pd.DataFrame()
  df["rawdate"]=mydates
  df["month_15"] = df["rawdate"].apply(lambda r: datetime.date( r.year, r.month,15 ) )
  
  dates_input = df["month_15"].astype('datetime64[D]')
  print dates_input.dtype # Why datetime64[ns] and not datetime64[D] ??
  
  
  @numba.jit(nopython=True)
  def testf(dates):
      return 1
  
  print testf(mydates)
  </code></pre>
  
  <p>The error I get if I run <code>testdf(dates_input)</code> is:</p>
  
  <pre><code>numba.typeinfer.TypingError: Failed at nopython (nopython frontend)
  Var 'dates' unified to object: dates := {pyobject}
  </code></pre>