-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
REGR: Fix construction of PeriodIndex from strings #33304
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 4 commits
fd2fa21
3398a52
a95ec4e
3ed3856
81eddc8
a4b1bb4
71c7cf4
5c0095a
b2e570b
483c975
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 |
---|---|---|
|
@@ -868,3 +868,10 @@ def test_searchsorted_datetimelike_with_listlike_invalid_dtype(values, arg): | |
msg = "[Unexpected type|Cannot compare]" | ||
with pytest.raises(TypeError, match=msg): | ||
values.searchsorted(arg) | ||
|
||
|
||
@pytest.mark.parametrize("klass", [list, tuple, np.array, pd.Series]) | ||
def test_period_index_construction_from_strings(klass): | ||
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. can you add the issue number. |
||
result = PeriodIndex(klass(["2020Q1", "2020Q2", "2020Q3", "2020Q4"]), freq="Q") | ||
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. can you do data = ... so that result = statement is the bit being tested. (i.e. we are not testing the klass constructor) can you also use the data from the OP, since that was not monotonic |
||
expected = pd.period_range(start="2020", periods=4, freq="Q") | ||
tm.assert_index_equal(result, expected) |
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.
could maybe add these cases to test_period_array_ok instead/as well.