Skip to content

Feature request: anchoring suffix for hours #33129

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
yohplala opened this issue Mar 29, 2020 · 0 comments
Open

Feature request: anchoring suffix for hours #33129

yohplala opened this issue Mar 29, 2020 · 0 comments
Labels

Comments

@yohplala
Copy link

yohplala commented Mar 29, 2020

Code Sample, a copy-pastable example if possible

# It is possible to use anchor suffix for weeks
off1 = pd.tseries.frequencies.to_offset('1W-SUN')

# The anchor does effect when using period_range() or creating a period
ts_start = pd.Timestamp('2020-03-25 10:00') # ts_start is a Wednesday

p1 = pd.Period(ts_start, freq=off1)
# Anchor is working: p1 with weekly frequency starts a Monday
p1.start_time
>>> Out: Timestamp('2020-03-23 00:00:00')

# But it doesn't work with '4H' frequency
off2 = pd.tseries.frequencies.to_offset('4H')

# No anchor (expecting one with reference being midnight)
off2.is_anchored()
>>> False

p2 = pd.Period(ts_start, freq=off2)

# Expecting '2020-03-25 08:00:00'
p2.start_time
>>> Timestamp('2020-03-25 10:00:00')

# Trying syntax similar to weekly anchoring
off3 = pd.tseries.frequencies.to_offset('4H-0')
>>> ValueError: Invalid frequency: 4H-0

Problem description

Please, can anchoring suffix be made available for hours, using midnight as the reference point?

Thanks for your feebdack,
Have a good day,
Bests,

@yohplala yohplala changed the title feature request: anchoring suffix for hours Feature request: anchoring suffix for hours Mar 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants