-
-
Notifications
You must be signed in to change notification settings - Fork 18k
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
BUG: QuarterBegin Does not work with Period #55785
Comments
@cancan101 import pandas as pd print (period) |
That is the same as using
and
However, I want to use |
Hi , the above error says , "_period_dtype_code" attribute not found . Which means the class "QuarterBegin" does not have the attribute "_period_dtype_code" . I checked the code , in file "offset.pyx" , we have the class "QuarterBegin" and it does not have the attribute "_period_dtype_code" . Hence we are seeing the above error. I think , this needs to be fixed in code . Is someone working on this ?. |
Yea it seems like that code should be fixed with either support or a better error message. and / or the docs might need to be made more clear as the way I read them, QuarterBegin should work: |
cc @natmokval maybe we should avoid having _period_dtype_code bubble up in the exception message? we need to be more clear that some offsets are not supported as period |
Thank you @cancan101 for the report. We are working on renaming some offset aliases, e.g. 'M' to 'ME' (#52064), 'Q' to 'QE' ( #55553), 'Y' to 'YE' (#55792). The goal is to separate them from Period aliases: 'M', 'Q', 'Y'. These changes are on main so far and they will be in the next release. Expected Behavior is a valid frequency for Period can be either string |
some offsets are not supported as period frequencies, e.g. offset class |
Thank you, @cancan101. I agree, we need a better error message and documentation might be more clear in this part. I think we should show an error message that some offsets are not supported as period frequencies and I will make PR for this. Documentation for Time series is updated (link) . In the new version we point out that for Anchored offsets only frequencies like
|
thank you, I agree, it would be better to raise a ValueError, with a message that some offsets are not supported as period frequencies. I will make PR. |
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
Unable to to create a Quarterly period as defined by the start of the quarter vs the end.
Might be related to this very old issue: #5091
Expected Behavior
Installed Versions
INSTALLED VERSIONS
commit : a60ad39
python : 3.12.0.final.0
python-bits : 64
OS : Darwin
OS-release : 22.1.0
Version : Darwin Kernel Version 22.1.0: Sun Oct 9 20:19:12 PDT 2022; root:xnu-8792.41.9~3/RELEASE_ARM64_T6020
machine : arm64
processor : arm
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 2.1.2
numpy : 1.26.1
pytz : 2023.3.post1
dateutil : 2.8.2
setuptools : 68.2.2
pip : 23.3.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 : 3.1.2
IPython : 8.17.2
pandas_datareader : None
bs4 : 4.12.2
bottleneck : None
dataframe-api-compat: None
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : 3.8.0
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : 1.11.3
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
zstandard : None
tzdata : 2023.3
qtpy : None
pyqt5 : None
The text was updated successfully, but these errors were encountered: