-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: Inconsistent "is_year_start" from DatetimeIndex with freq "MS" #57377
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
Labels
Comments
Thanks for the report. Confirmed on main, further investigations and PRs to fix are welcome! |
take |
Upon further inspection, it looks like is_quarter_start with the freq 'MS' is having the same issue idx = pd.date_range('2017-01-01', periods=6, freq='MS')
idx[idx.is_quarter_start] This gives the dates 2017-03-01 and 2017-06-01, which are of course not the actual start of quarters |
4 tasks
looks like this was already reported earlier: #49606 |
MarcoGorelli
added a commit
that referenced
this issue
Jun 8, 2024
… with freq 'MS' date_range (#57377) (#57494) * Added some comments to where the bug is occurring * Potential fix, passed all potentially relevant tests * Very likely fix * Reverted ro previous start/end scheme; added tests * Added fixes to whatsnew doc * Removed stray comment * Fixed alphabetical problem in whatsnew * add parametric test * fixup --------- Co-authored-by: Marco Gorelli <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Issue Description
When working with DatetimeIndex with frequency "MS" the attribute "is_year_start" does not obtain the same attribute if you obtain the attribute directly from the DatatimeIndex instead of obtaining directly from each individual value of the DatetimeIndex.
Expected Behavior
I would expect for the same array of attributes independently of if it is obtained from a comprehensive list or as an attibute as shown in the documentation.
https://pandas.pydata.org/docs/reference/api/pandas.DatetimeIndex.is_year_start.html
Installed Versions
INSTALLED VERSIONS
commit : f538741
python : 3.11.6.final.0
python-bits : 64
OS : Linux
OS-release : 3.10.0-1160.95.1.el7.x86_64
Version : #1 SMP Fri Jun 23 08:44:55 EDT 2023
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : en_US.UTF-8
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 2.2.0
numpy : 1.26.4
pytz : 2024.1
dateutil : 2.8.2
setuptools : 68.2.2
pip : 23.2.1
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : 8.16.1
pandas_datareader : None
adbc-driver-postgresql: None
adbc-driver-sqlite : None
bs4 : None
bottleneck : None
dataframe-api-compat : None
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : None
numba : None
numexpr : None
odfpy : None
openpyxl : 3.1.2
pandas_gbq : None
pyarrow : None
pyreadstat : None
python-calamine : None
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : 2.0.21
tables : None
tabulate : None
xarray : None
xlrd : None
zstandard : None
tzdata : 2023.4
qtpy : None
pyqt5 : None
The text was updated successfully, but these errors were encountered: