Skip to content

ISO 8601 durations returned by Libreoffice/odfpy aren't compatible with current Timedelta parser #25422

Closed
@detrout

Description

@detrout

Code Sample, a copy-pastable example if possible

pandas.Timedelta('PT03H45M00S')

Problem description

Raises ValueError invalid abbreviation.

It should behave like:

pandas.Timedelta('P0DT0H1M0S')
Timedelta('0 days 00:01:00')

According to https://www.w3.org/TR/2004/REC-xmlschema-2-20041028/#duration

If the number of years, months, days, hours, minutes, or seconds in any expression equals zero, the number and its corresponding designator ·may· be omitted. However, at least one number and its designator ·must· be present.

Implies that durations like PT3H45M0S or P30D or PT2S are syntactically valid.

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

commit: None
python: 3.7.2.final.0
python-bits: 64
OS: Linux
OS-release: 4.19.0-2-amd64
machine: x86_64
processor:
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8

pandas: 0.23.3
pytest: 3.10.1
pip: 18.1
setuptools: 40.7.1
Cython: 0.29.2
numpy: 1.16.1
scipy: 1.1.0
pyarrow: None
xarray: None
IPython: 5.8.0
sphinx: 1.8.3
patsy: 0.5.0+dev
dateutil: 2.7.3
pytz: 2018.9
blosc: 1.7.0
bottleneck: None
tables: 3.4.4
numexpr: 2.6.9
feather: None
matplotlib: 3.0.2
openpyxl: 2.4.9
xlrd: 1.1.0
xlwt: None
xlsxwriter: None
lxml: 4.3.0
bs4: 4.7.1
html5lib: 1.0.1
sqlalchemy: 1.2.15
pymysql: None
psycopg2: 2.7.7 (dt dec pq3 ext lo64)
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: 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