Skip to content

BUG: inconsistency in the behaviour of DatetimeIndex.is_year_start on the frequency "BYS" #58920

@natmokval

Description

@natmokval

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

idx = pd.date_range("2020-10-30", periods=5, freq="BYS")
print(idx)
print(idx.is_year_start)

dates = pd.Series(idx)
print(dates.dt.is_year_start)

Issue Description

This outputs:

DatetimeIndex(['2021-01-01', '2022-01-03', '2023-01-02', '2024-01-01',
'2025-01-01'],
dtype='datetime64[ns]', freq='BYS-JAN')
[ True True True True True]
0 True
1 False
2 False
3 True
4 True
dtype: bool

Expected Behavior

it should return the same result in both cases, for DatetimeIndex.is_year_start and Series.dt.is_year_start.

Installed Versions

INSTALLED VERSIONS

commit : ae1928b
python : 3.10.14.final.0
python-bits : 64
OS : Linux
OS-release : 6.1.0-21-amd64
Version : #1 SMP PREEMPT_DYNAMIC Debian 6.1.90-1 (2024-05-03)
machine : x86_64
processor :
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8

pandas : 3.0.0.dev0+478.gae1928b0aa.dirty
numpy : 1.26.4
pytz : 2024.1
dateutil : 2.9.0
setuptools : 70.0.0
pip : 24.0
Cython : 3.0.10
pytest : 8.2.2
hypothesis : 6.103.0
sphinx : 7.3.7
blosc : None
feather : None
xlsxwriter : 3.1.9
lxml.etree : 5.2.2
html5lib : 1.1
pymysql : 1.4.6
psycopg2 : 2.9.9
jinja2 : 3.1.4
IPython : 8.25.0
pandas_datareader : None
adbc-driver-postgresql: None
adbc-driver-sqlite : None
bs4 : 4.12.3
bottleneck : 1.3.8
fastparquet : 2024.5.0
fsspec : 2024.6.0
gcsfs : 2024.6.0
matplotlib : 3.8.4
numba : 0.59.1
numexpr : 2.10.0
odfpy : None
openpyxl : 3.1.2
pyarrow : 16.1.0
pyreadstat : 1.2.7
python-calamine : None
pyxlsb : 1.0.10
s3fs : 2024.6.0
scipy : 1.13.1
sqlalchemy : 2.0.30
tables : 3.9.2
tabulate : 0.9.0
xarray : 2024.5.0
xlrd : 2.0.1
zstandard : 0.19.0
tzdata : 2024.1
qtpy : None
pyqt5 : None

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugDatetimeDatetime data dtypeFrequencyDateOffsetsNeeds TriageIssue that has not been reviewed by a pandas team member

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions