BUG: Incorrect parsing of ISO 8601 durations · Issue #36204 · pandas-dev/pandas (original) (raw)
Navigation Menu
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Appearance settings
Description
- [x ] I have checked that this issue has not already been reported.
- [ x] I have confirmed this bug exists on the latest version of pandas.
- (optional) I have confirmed this bug exists on the master branch of pandas.
Code Sample, a copy-pastable example
pd.Timedelta('P1Y') pd.Timedelta('P1M') pd.Timedelta('P1W') pd.Timedelta('P1D') pd.Timedelta('P1DT1H') pd.Timedelta('PT1H') pd.Timedelta('P1H')
Problem description
Trying most iso8601 duration formats fails.
For above examples:
- Expected pd.Timedelta instances of 1yr, 1mo, 1wk, 1d, 1d 1hr
- ... but got
ValueError: Invalid ISO 8601 Duration format - ...
on Y/M/W, PT1H - ... 1D was '0'
- ... 1DT1H was '1d' (no hr)
Encountered while trying to figure out neo4j.time.Duration().isoformat() -> pandas ->arrow > rapids cudf timedelta[*] . Neo4j returns values like P1Y3M15DT2H3M
and P1Y3M
.