Code Sample, a copy-pastable example if possible

In [2]: idx = pd.date_range(start='2010-08-08', end='2010-08-15')

In [3]: idx.map(lambda x : x + pd.Timedelta('3 days'))
Out[3]: 
DatetimeIndex(['2010-08-11', '2010-08-12', '2010-08-13', '2010-08-14',
               '2010-08-15', '2010-08-16', '2010-08-17', '2010-08-18'],
              dtype='datetime64[ns]', freq='D')

In [4]: idx.map(lambda x : pd.Timestamp(x) + pd.Timedelta('3 days'))
Out[4]: 
DatetimeIndex(['2010-08-11', '2010-08-12', '2010-08-13', '2010-08-14',
               '2010-08-15', '2010-08-16', '2010-08-17', '2010-08-18'],
              dtype='datetime64[ns]', freq=None)

Problem description

This results from the combination of two problems.

  1. DatetimeIndex.map() does some pretty horrible thing: it first tries to call the passed function on the calling instance, and only if this fails (according to some debatable definition of "failure") it calls it on each element of the instance. freq is preserved if the first call goes through; otherwise it is not.
  2. 22311

... but problem 1. must fixed anyway - the behavior doesn't make much sense, is DatetimeIndex-specific, and undocumented.

Expected Output

Out[3] and Out[4] should coincide.

Output of pd.show_versions()

[paste the output of ``pd.show_versions()`` here below this line]

Comment From: mroeschke

This looks to match now based on mapping refactor that was done for 2.1. I think we have tests for this case now so closing