Skip to content

TypeError in pandas._libs.tslibs.period._ordinal_from_fields #22067

Closed
@aabdullah-bos

Description

@aabdullah-bos

Using pandas 0.23.3 I receive a TypeErorr when running the following code:

import pandas
ts = pandas.date_range('2017-01-01', '2018-01-01', freq='B')
months = ts.map(lambda x: pandas.Period(year=x.year, month=x.month, freq='M'))
# Screen output even though operation succeeds.
# TypeError                                 Traceback (most recent call last)
# TypeError: an integer is required
# Exception TypeError: 'an integer is required' in 'pandas._libs.tslibs.period._ordinal_from_fields' ignored

Oddly, enough the operation succeeds, months has the correct data.

Expected Output

I would expect no output to stderr or stdout, just the correct assignment of the map operation. This is more of an annoyance than anything else.

Output of pd.show_versions()

pandas.show_versions()

INSTALLED VERSIONS
------------------
commit: None
python: 2.7.15.final.0
python-bits: 64
OS: Darwin
OS-release: 17.7.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: None.None

pandas: 0.23.3
pytest: None
pip: 18.0
setuptools: 40.0.0
Cython: None
numpy: 1.13.0
scipy: 1.1.0
pyarrow: None
xarray: None
IPython: 5.7.0
sphinx: None
patsy: None
dateutil: 2.7.3
pytz: 2018.5
blosc: None
bottleneck: None
tables: 3.4.4
numexpr: 2.6.6
feather: None
matplotlib: 2.2.2
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: 1.0.1
sqlalchemy: 1.2.10
pymysql: 0.9.2
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None

[paste the output of pd.show_versions() here below this line]

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugDatetimeDatetime data dtypeError ReportingIncorrect or improved errors from pandas

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions