BUG: Series(DTI/TDI) loses the frequency information from original DTI/TDI #20937
Labels
Bug
Datetime
Datetime data dtype
freq retention
User expects "freq" attribute to be preserved
Frequency
DateOffsets
Needs Discussion
Requires discussion from core team before further action
Code Sample, a copy-pastable example if possible
DTI example below, same general behavior occurs for TDI:
This appears to be caused by the
dt
accessor overriding thefreq
definition, which was done for perf reasons in #17210:pandas/pandas/core/indexes/accessors.py
Lines 174 to 176 in b02c69a
If I remove the code above, the resulting frequency of the
Series
isNone
. This is consistent with one of the error messages displayed when trying to add an integer to theSeries
, which works at the DTI/TDI level when a frequency is present:Problem description
Series
ignores the original frequency, and subsequent frequency dependent operations do not work.Expected Output
I'd expect frequency to be retained, and frequency dependent operations to work when one is set.
Output of
pd.show_versions()
INSTALLED VERSIONS
commit: b02c69a
python: 3.6.1.final.0
python-bits: 64
OS: Windows
OS-release: 10
machine: AMD64
processor: Intel64 Family 6 Model 78 Stepping 3, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None
pandas: 0.23.0rc2
pytest: 3.1.2
pip: 9.0.1
setuptools: 39.0.1
Cython: 0.28.2
numpy: 1.13.3
scipy: 1.0.0
pyarrow: 0.6.0
xarray: 0.9.6
IPython: 6.1.0
sphinx: 1.5.6
patsy: 0.4.1
dateutil: 2.6.0
pytz: 2017.2
blosc: None
bottleneck: 1.2.1
tables: 3.4.2
numexpr: 2.6.4
feather: 0.4.0
matplotlib: 2.0.2
openpyxl: 2.4.8
xlrd: 1.1.0
xlwt: 1.3.0
xlsxwriter: 0.9.8
lxml: 3.8.0
bs4: None
html5lib: 0.999
sqlalchemy: 1.1.13
pymysql: None
psycopg2: None
jinja2: 2.9.6
s3fs: None
fastparquet: 0.1.5
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: