-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Set frequency for empty Series #14458
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 |
---|---|---|
|
@@ -398,6 +398,14 @@ def test_asfreq_fillvalue(self): | |
actual_series = ts.asfreq(freq='1S', fill_value=9.0) | ||
assert_series_equal(expected_series, actual_series) | ||
|
||
def test_asfreq_datetimeindex_empty_series(self): | ||
# GH 14340 | ||
expected = Series(index=pd.DatetimeIndex( | ||
["2016-09-29 11:00"])).asfreq('H') | ||
result = Series(index=pd.DatetimeIndex(["2016-09-29 11:00"]), | ||
data=[3]).asfreq('H') | ||
self.assert_index_equal(expected.index, result.index) | ||
|
||
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. compare the series, e.g. you have two results to compare here, what you currently have labeled as expected and as result. make another tests where you construct the expected directly (iow, dont' use |
||
def test_first_last_valid(self): | ||
N = len(self.frame.index) | ||
mat = randn(N) | ||
|
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.
Can you create one of the two without using
asfreq
.Further, it is not fully clear what is what you actually testing, as the result of the empty series is called
expected
(you typically call the constructed expected valueexpected
to compare the result of what you want to test)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.
@jorisvandenbossche Actually the issue was that we didn't set frequency properly for empty series. Hence I'm testing this particular thing by comparing with frequency of a non-empty
Series
that we make using similar parameters with an empty one.