Skip to content
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

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

Closed
detrout opened this issue Feb 23, 2019 · 3 comments
Labels
Duplicate Report Duplicate issue or pull request

Comments

@detrout
Copy link
Contributor

detrout commented Feb 23, 2019

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

@WillAyd
Copy link
Member

WillAyd commented Feb 26, 2019

I think this is the same thing as #22815 no?

@WillAyd WillAyd added the Duplicate Report Duplicate issue or pull request label Feb 26, 2019
@detrout
Copy link
Contributor Author

detrout commented Feb 26, 2019

The references referring to_timedelta made me think #22815 was a request to change the output format for timedeltas. Here I'm asking that the Timedelta input parser be updated to handle the ISO8601 standardized duration format.

On the other hand it'd be pretty reasonable to require that:

Timedelta(a.to_timedelta()) == a

Which would resolve this issue.

@mroeschke
Copy link
Member

Closing as a duplicate of #29773

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate Report Duplicate issue or pull request
Projects
None yet
Development

No branches or pull requests

3 participants