title: Why pandas strftime raises a FutureWarning and how to avoid it?
body: <p>I need to <strong>parse a date column to a string</strong>, it works, but I'm having some issues, first of all is not giving a string data-type as an output:</p>
  <pre><code>import pandas as pd  # No warning raised
  exit_format = '%d-%m-%Y'
  series = pd.Series([1,2,None] ,dtype='datetime64[ns]')
  series.dt.strftime(exit_format)
  </code></pre>
  <p>This (intended behaviour) is not a big deal as can it can be fixed with <code>astype('string')</code> and replacing the <code>Nan</code>. But the worst thing is that if all values are NaN-Nat, I'm getting this <code>FutureWarning</code>:</p>
  <pre><code># Warning raised!
  series = pd.Series([None,None,None] ,dtype='datetime64[ns]')
  series.dt.strftime(exit_format)
  
  FutureWarning: In a future version, the Index constructor will not infer numeric dtypes when passed object-dtype sequences (matching Series behavior)
  </code></pre>
  <p>This seems to be come from a <a href="https://github.com/pandas-dev/pandas/issues/45858" rel="nofollow noreferrer">known issue</a> at pandas version &gt;= 1.4.0 (mine is '1.4.1'). My question is, how can I make a nice workaround? Why this warning appears in the first place when all values are Nan? Preferably I'm looking for a solution that doesn't suppress the warning directly but his origin.</p>
  <p>Basically I'm looking for a function that takes a date column to a string column but parsing NaNs as empty strings or treating the errors in a better way (like using a default value), but without giving a warning.</p>
  <p>pd: a possible solution could be adding a non empty row at the end and deleting it, but I was wandering if there is some implemented function that is actually working well, without using tricks...</p>