Skip to content

Implement ISO8601 durations as addition for Offset Aliases #22815

Open
@Haigutus

Description

@Haigutus

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.

Activity

mroeschke

mroeschke commented on Sep 25, 2018

@mroeschke
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.

WillAyd

WillAyd commented on Sep 25, 2018

@WillAyd
Member

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

added this to the Contributions Welcome milestone on Sep 25, 2018
Haigutus

Haigutus commented on Oct 3, 2018

@Haigutus
Author

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

Flix6x

Flix6x commented on Mar 14, 2021

@Flix6x
Contributor

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.

removed this from the Contributions Welcome milestone on Oct 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @WillAyd@mroeschke@Haigutus@Flix6x

        Issue actions

          Implement ISO8601 durations as addition for Offset Aliases · Issue #22815 · pandas-dev/pandas