-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: resample by BusinessHour raises ValueError #16447
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2564,6 +2564,37 @@ def test_upsample_daily_business_daily(self): | |
expected = ts.asfreq('H', how='s').reindex(exp_rng) | ||
assert_series_equal(result, expected) | ||
|
||
def test_resample_business_hourly(self): | ||
# GH12351 | ||
rng = pd.date_range(start='2017-05-18 00:00:00', | ||
end='2017-05-19 23:00:00', | ||
freq='H') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. these are asfreq tests, NOT resample tests. |
||
expected_rng = pd.date_range(start='2017-05-18 00:00:00', | ||
end='2017-05-19 23:00:00', | ||
freq='BH') | ||
ts = Series(1, index=rng) | ||
result = ts.asfreq('BH') | ||
expected_ts = Series(1, index=expected_rng) | ||
|
||
assert_series_equal(result, expected_ts) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you add a test against a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just added it. Please take a look if it's okay. |
||
def test_resample_custom_business_hourly(self): | ||
# GH12351 | ||
rng = pd.date_range(start='2017-05-18 00:00:00', | ||
end='2017-05-19 23:00:00', | ||
freq='H') | ||
|
||
hours = offsets.CustomBusinessHour(start='10:00') | ||
expected_rng = pd.date_range(start='2017-05-18 00:00:00', | ||
end='2017-05-19 23:00:00', | ||
freq=hours) | ||
|
||
ts = Series(1, index=rng) | ||
result = ts.asfreq(hours) | ||
expected_ts = Series(1, index=expected_rng) | ||
|
||
assert_series_equal(result, expected_ts) | ||
|
||
def test_resample_irregular_sparse(self): | ||
dr = date_range(start='1/1/2012', freq='5min', periods=1000) | ||
s = Series(np.array(100), index=dr) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not what I meant. This is not a general fix at all. This is the same as before. The question is what kind of offset needs to do this kind of rollback / normalization.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got your point. so do we need to generalize the edges detection here?