Skip to content

BUG: pd.PeriodDtype(freq=CustomBusinessDay()) raises on main but isn't deprecated #52790

Closed
@twoertwein

Description

@twoertwein

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
from pandas.tseries.offsets import CustomBusinessDay

pd.PeriodDtype(freq=CustomBusinessDay()) # raises TypeError: CustomBusinessDay cannot be used with Period or PeriodDtype

Issue Description

The above works on 2.0 without any FutureWarning but raises on main.

xref pandas-dev/pandas-stubs#640

Expected Behavior

Add a deprecation warning

Installed Versions

INSTALLED VERSIONS ------------------ commit : 478d340 python : 3.11.2.final.0 python-bits : 64 OS : Linux OS-release : 6.2.9-200.fc37.x86_64 Version : #1 SMP PREEMPT_DYNAMIC Thu Mar 30 22:31:57 UTC 2023 machine : x86_64 processor : byteorder : little LC_ALL : None LANG : C.UTF-8 LOCALE : en_US.UTF-8 pandas : 2.0.0 numpy : 1.24.2 pytz : 2023.3 dateutil : 2.8.2 setuptools : 67.6.1 pip : 22.3.1 Cython : 0.29.34 pytest : 7.3.1 hypothesis : None sphinx : None blosc : None feather : None xlsxwriter : 3.0.7 lxml.etree : 4.9.2 html5lib : 1.1 pymysql : None psycopg2 : None jinja2 : 3.1.2 IPython : 8.8.0 pandas_datareader: None bs4 : None bottleneck : None brotli : None fastparquet : None fsspec : 2023.4.0 gcsfs : None matplotlib : None numba : None numexpr : 2.8.4 odfpy : None openpyxl : None pandas_gbq : None pyarrow : 11.0.0 pyreadstat : None pyxlsb : None s3fs : None scipy : 1.10.1 snappy : None sqlalchemy : None tables : 3.8.0 tabulate : None xarray : None xlrd : 2.0.1 zstandard : None tzdata : 2023.3 qtpy : None pyqt5 : None

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions