-
-
Notifications
You must be signed in to change notification settings - Fork 19.6k
Description
Pandas version checks
-
I have checked that this issue has not already been reported.
-
I have confirmed this bug exists on the latest version of pandas.
-
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
import pandas as pd
dates = pd.date_range('20151231', periods=500, freq='6BME',
unit='s') + pd.offsets.BDay(1)
inferred_freq = pd.Index(dates).inferred_freqIssue Description
The code above, infers the wrong frequency, it should be 2BQS-JAN and not 2BQS-OCT
DatetimeIndex(['2016-01-01', '2016-07-01', '2017-01-02', '2017-07-03',
'2018-01-01', '2018-07-02', '2019-01-01', '2019-07-01',
'2020-01-01', '2020-07-01',
...
'2261-01-01', '2261-07-01', '2262-01-01', '2262-07-01',
'2263-01-01', '2263-07-01', '2264-01-01', '2264-07-01',
'2265-01-02', '2265-07-03'],
dtype='datetime64[s]', length=500, freq=None)
2BQS-OCT
Expected Behavior
2BQS-JAN should be the correct freq
Installed Versions
INSTALLED VERSIONS
commit : d9cdd2e
python : 3.12.4.final.0
python-bits : 64
OS : Windows
OS-release : 11
Version : 10.0.26100
machine : AMD64
processor : Intel64 Family 6 Model 186 Stepping 2, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : English_Switzerland.1252
pandas : 2.2.2
numpy : 1.26.4
pytz : 2024.1
dateutil : 2.9.0
setuptools : 72.1.0
pip : 24.2
Cython : 3.0.11
pytest : 8.3.2
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : 3.1.9
lxml.etree : 5.2.2
html5lib : 1.1
pymysql : None
psycopg2 : 2.9.9
jinja2 : 3.1.4
IPython : 8.21.0
pandas_datareader : 0.10.0
adbc-driver-postgresql: None
adbc-driver-sqlite : None
bs4 : 4.12.3
bottleneck : None
dataframe-api-compat : None
fastparquet : None
fsspec : 2024.6.1
gcsfs : None
matplotlib : 3.9.1
numba : 0.60.0
numexpr : 2.10.0
odfpy : None
openpyxl : 3.1.4
pandas_gbq : None
pyarrow : 17.0.0
pyreadstat : None
python-calamine : None
pyxlsb : None
s3fs : None
scipy : 1.13.1
sqlalchemy : 2.0.31
tables : 3.9.2
tabulate : 0.9.0
xarray : None
xlrd : 2.0.1
zstandard : 0.23.0
tzdata : 2024.1
qtpy : None
pyqt5 : None