BUG: pandas Timestamp tz_localize and tz_convert do not preserve freq
attribute
#25241
Labels
Milestone
freq
attribute
#25241
The
pandas.Timestamp.tz_localize()
andpandas.Timestamp.tz_convert()
methods do not preserve thefreq
attribute. For background, thefreq
attribute is mostly a "helpful label", and it seems semantically ill-defined to me; cf. issue #15146, which proposes removing the attribute.Code Sample
Problem description
I don't think that
pandas.Timestamp
should actually have afreq
attribute, but so long as it does, it should be propagated to the new timestamp value returned bytz_localize()
ortz_convert
. In thetz_convert
case, the method should produce an "equivalent" timestamp with a different tz.Expected Output
t1.tz_localize(pytz.utc).freq
should equalt1.freq
, andt2.tz_convert(pytz.utc).freq
should equalt2.freq
.Output of
pd.show_versions()
No module named 'dask'
INSTALLED VERSIONS
commit: 04df22f
python: 3.7.2.final.0
python-bits: 64
OS: Darwin
OS-release: 17.7.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8
pandas: 0.25.0.dev0+89.g04df22fbe
pytest: 4.2.0
pip: 19.0.1
setuptools: 40.7.3
Cython: 0.29.4
numpy: 1.15.4
scipy: 1.2.0
pyarrow: 0.11.1
xarray: 0.11.0
IPython: 7.2.0
sphinx: 1.8.4
patsy: 0.5.1
dateutil: 2.7.5
pytz: 2018.9
blosc: None
bottleneck: 1.2.1
tables: 3.4.4
numexpr: 2.6.9
feather: None
matplotlib: 3.0.2
openpyxl: 2.5.14
xlrd: 1.2.0
xlwt: 1.3.0
xlsxwriter: 1.1.2
lxml.etree: 4.3.0
bs4: 4.7.1
html5lib: 1.0.1
sqlalchemy: 1.2.17
pymysql: 0.9.3
psycopg2: None
jinja2: 2.10
s3fs: 0.2.0
fastparquet: 0.2.1
pandas_gbq: None
pandas_datareader: None
gcsfs: 0.1.2
The text was updated successfully, but these errors were encountered: