Description
Code Sample, a copy-pastable example if possible
import pandas as pd
dti = pd.DatetimeIndex([], name='my_dti', freq='H')
print(dti.round('D')) # Name is preserved
print(dti.snap('D')) # Name is lost
Problem description
The DatetimeIndex.snap method loses the name of the DatetimeIndex which is a different behaviour than DatetimeIndex.round (or floor, ceil, etc.) that preserves the name of the DatetimeIndex.
Expected Output
DatetimeIndex([], dtype='datetime64[ns]', name='my_dti', freq='D')
Output of pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.6.7.final.0
python-bits: 64
OS: Linux
OS-release: 4.15.0-45-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_CA.UTF-8
LOCALE: en_CA.UTF-8
pandas: 0.24.1
pytest: 4.0.0
pip: 19.0.3
setuptools: 40.4.3
Cython: 0.29.6
numpy: 1.16.2
scipy: 1.2.1
pyarrow: None
xarray: None
IPython: 7.3.0
sphinx: None
patsy: 0.5.0
dateutil: 2.7.3
pytz: 2018.3
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: 3.0.3
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml.etree: 4.2.1
bs4: None
html5lib: 1.0.1
sqlalchemy: 1.2.18
pymysql: None
psycopg2: 2.7.7 (dt dec pq3 ext lo64)
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: 0.9.0
pandas_datareader: None
gcsfs: None