Skip to content

BUG: Period.now() does not accept kwarg "freq" but doc and typing say otherwise #53369

Closed
@tscheburaschka

Description

@tscheburaschka

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
p = pd.Period.now(freq='D')

# Gives: "TypeError: Period.now() takes no keyword arguments"

p = pd.Period.now('D')  
# Gives: Period('2023-05-24', 'D')
# BTW, here the type checker complains about wrong type, expects 'BaseOffset' not 'str'

Issue Description

The method call Period.now(freq="D") raises a "TypeError: Period.now() takes no keyword arguments" but this behavior deviates from Pandas 1.5.X and is in contradiction to type annotations and not documented.

Expected Behavior

The kwarg "freq" should work or it should be documented accordingly in type annotations and as breaking change.

Installed Versions

INSTALLED VERSIONS

commit : 37ea63d
python : 3.11.3.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.14393
machine : AMD64
processor : Intel64 Family 6 Model 85 Stepping 0, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : de_DE.cp1252

pandas : 2.0.1
numpy : 1.24.3
pytz : 2023.3
dateutil : 2.8.2
setuptools : 67.8.0
pip : 23.1.2
Cython : None
pytest : 7.3.1
hypothesis : 6.75.3
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : 2.9.6
jinja2 : None
IPython : None
pandas_datareader: None
bs4 : 4.12.2
bottleneck : None
brotli : None
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : None
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : 10.0.1
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : None
snappy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
zstandard : None
tzdata : 2023.3
qtpy : None
pyqt5 : None

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions