Skip to content

BUG: Freq argument lost using pd.infer_freq #38243

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
2 of 3 tasks
rwijtvliet opened this issue Dec 2, 2020 · 2 comments
Closed
2 of 3 tasks

BUG: Freq argument lost using pd.infer_freq #38243

rwijtvliet opened this issue Dec 2, 2020 · 2 comments
Labels
Bug Closing Candidate May be closeable, needs more eyeballs Datetime Datetime data dtype

Comments

@rwijtvliet
Copy link

rwijtvliet commented Dec 2, 2020

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • (optional) I have confirmed this bug exists on the master branch of pandas.


Code Sample, a copy-pastable example

import pandas as pd

# reference, works: 2 normal days.
i0 = pd.date_range('2020-09-24', '2020-09-26', freq='H', closed='left', tz='Europe/Berlin')
pd.infer_freq(i0)  # 'H'   (i0.freq == '<Hour>')

# problem, does not work: summertime to wintertime changeover.
i1 = pd.date_range('2020-10-24', '2020-10-26', freq='H', closed='left', tz='Europe/Berlin')
pd.infer_freq(i1)  # '' <-- !!!!!    (even though i1.freq == '<Hour>')

# for completeness, works: wintertime to summertime changeover
i2 = pd.date_range('2020-03-28', '2020-03-30', freq='H', closed='left', tz='Europe/Berlin')
pd.infer_freq(i2)  # 'H'     (i2.freq == '<Hour>')

Problem description

Even though i1 has the frequency attribute correctly set, pd.infer_freq(i1) returns an empty string.

Expected Output

'H', just like when using i0 or i2.

Output of pd.show_versions()

INSTALLED VERSIONS

commit : db08276
python : 3.8.5.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.18362
machine : AMD64
processor : Intel64 Family 6 Model 158 Stepping 10, GenuineIntel
byteorder : little
LC_ALL : None
LANG : en
LOCALE : de_DE.cp1252

pandas : 1.1.3
numpy : 1.19.2
pytz : 2020.4
dateutil : 2.8.1
pip : 20.3
setuptools : 50.3.2.post20201202
Cython : None
pytest : 6.1.2
hypothesis : None
sphinx : 3.2.1
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : 1.0.1
pymysql : None
psycopg2 : None
jinja2 : 2.11.2
IPython : 7.19.0
pandas_datareader: None
bs4 : 4.9.1
bottleneck : None
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : 3.3.2
numexpr : None
odfpy : None
openpyxl : 3.0.5
pandas_gbq : None
pyarrow : None
pytables : None
pyxlsb : None
s3fs : None
scipy : 1.5.2
sqlalchemy : 1.3.20
tables : None
tabulate : None
xarray : None
xlrd : 1.2.0
xlwt : None
numba : None

@rwijtvliet rwijtvliet added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Dec 2, 2020
@lithomas1
Copy link
Member

lithomas1 commented Feb 23, 2021

@rwijtvliet I cannot reproduce this on master anymore, it looks like this was fixed by #39644. (xref #39556). If you also cannot reproduce this on master, please close the issue. Thanks!

@lithomas1 lithomas1 added Closing Candidate May be closeable, needs more eyeballs Datetime Datetime data dtype and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Feb 23, 2021
@mroeschke
Copy link
Member

Closing as fixed and working on master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Closing Candidate May be closeable, needs more eyeballs Datetime Datetime data dtype
Projects
None yet
Development

No branches or pull requests

3 participants