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

ENH: Add fold attribute to DatetimeIndex #47130

Open
gsheni opened this issue May 26, 2022 · 3 comments
Open

ENH: Add fold attribute to DatetimeIndex #47130

gsheni opened this issue May 26, 2022 · 3 comments
Labels
Enhancement Timezones Timezone data dtype

Comments

@gsheni
Copy link
Contributor

gsheni commented May 26, 2022

Is your feature request related to a problem?

As a pandas user, I wish I could use pandas to determine which values in a DatetimeIndex are using DST (Daylight Saving Time). This could be useful for a datetime column that recorded values year-round (ex - 1 column with EDT and EST datetimes).

Describe the solution you'd like

  • An attribute on DatetimeIndex that is named is_daylight_savings_time or is_dst)

API breaking implications

  • None, this is an additive feature

Additional context

@gsheni gsheni added Enhancement Needs Triage Issue that has not been reviewed by a pandas team member labels May 26, 2022
@gsheni gsheni changed the title ENH: Add is_dst to Timestamp ENH: Add is_dst attribute to DatetimeIndex May 26, 2022
@mroeschke
Copy link
Member

I tried implementing this a few years ago, and it was discouraged #22560 (comment) so I am not sure it's likely that this will be implemented

@jreback
Copy link
Contributor

jreback commented May 27, 2022

idk i think this could be useful (or we add fold instead maybe is better)

@mroeschke mroeschke added Timezones Timezone data dtype and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Aug 19, 2022
@mroeschke mroeschke changed the title ENH: Add is_dst attribute to DatetimeIndex ENH: Add fold attribute to DatetimeIndex Aug 20, 2022
@jbrockmendel
Copy link
Member

Following #49684, an easy (but non-performant) way to implement this will be folds = np.array([x.fold for x in self], dtype=bool). For a more performant implementation we'd need to refactor out parts of ints_to_pydatetime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Timezones Timezone data dtype
Projects
None yet
Development

No branches or pull requests

4 participants