Skip to content

Implement ISO8601 durations as addition for Offset Aliases #22815

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

Open
Haigutus opened this issue Sep 24, 2018 · 4 comments
Open

Implement ISO8601 durations as addition for Offset Aliases #22815

Haigutus opened this issue Sep 24, 2018 · 4 comments
Labels
Enhancement Timedelta Timedelta data type

Comments

@Haigutus
Copy link

Haigutus commented Sep 24, 2018

Code Sample, a copy-pastable example if possible

current     -> query_config["aggregation"] = "5min"
proposed -> query_config["aggregation"] = "PT5M"

resampled_dataframe = dataframe.resample(query_config["aggregation"], how = query_config["aggregation_type"], closed = query_config["closed"])

Problem description

https://en.wikipedia.org/wiki/ISO_8601#Durations

Current behavior uses non standardized markup for time duration, wich can cause errors and confusion. Implementing ISO8601 duration grantees standardized solution for time duration in PANDAS. It does not have to replace the current system rather extend it.

@mroeschke
Copy link
Member

I think this is a reasonable suggestion.

IIRC @WillAyd allowed to_timedelta to parse these durations. Some careful consideration will need to be address regarding how they are mapped to our Tick/DateOffset classes and existing offset aliases.

@mroeschke mroeschke added API Design Frequency DateOffsets Resample resample method labels Sep 25, 2018
@WillAyd
Copy link
Member

WillAyd commented Sep 25, 2018

Agreed this makes sense. Support for to_timedelta was added in #21933 so can certainly leverage that as a reference for potential implementation. PRs welcome

@WillAyd WillAyd added this to the Contributions Welcome milestone Sep 25, 2018
@Haigutus
Copy link
Author

Haigutus commented Oct 3, 2018

Maybe this could be reused - https://bitbucket.org/nielsenb/aniso8601

@Flix6x
Copy link
Contributor

Flix6x commented Mar 14, 2021

Compatibility with ISO8601 durations may not be possible before #22864 is resolved, because "P1D" (an ISO8601 nominal duration of 1 day) denotes a calendar day rather than 24 hours.

@mroeschke mroeschke removed this from the Contributions Welcome milestone Oct 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Timedelta Timedelta data type
Projects
None yet
Development

No branches or pull requests

4 participants